I recently took part in the macadmins podcast and had a great time, but there was one comment that struck a chord with me - Marcus Ransom thanked me for writing Cacher. Cacher is my most popular github repo and while I get thanked often for creating it, my reaction usually goes something like this:

Ugh

:scream: :scream: :scream: :scream: :scream: :scream: :scream: :scream: :scream: :scream:

Why?

Cacher was originally written to prove to a former boss that both my job and the equipment I had purchased was actually worth the cost. When I thought I had something of actual value I decided to actually upload it and see what other people thought - they liked it. When Apple heard about Cacher, I fully expected them to make a GUI wrapper and finally kill Cacher. That obviously hasn’t happened.

I’m really happy people like it…

But it’s written in shell…

…and consistently breaks each time a new iOS/macOS release comes out

…and can’t find new iOS devices when they are released

… and can’t handle personal iCloud files without having inaccurate statistics

… and I don’t really have a need for caching servers at the moment

…and in 2015 I basically said Cacher was dead and I would be merging my code with Allister’s Sashay.

…but I couldn’t stop thinking about Marcus’ comment

All throughout Christmas break, I kept thinking about how more people would possibly hear about Cacher and be intrigued to download it. Thoughts raced through my head about how I could improve the tool:

I could add a dynamic key/value store for the iOS devices!

I could add an for DeviceID’s!

I could add Slack support!

I could finally add custom date support!

I could remove the need for sudo/root permissions unless it’s actually needed!

What if Cacher could setup the Caching service logs?

… so I wrote Cacher 3.0 … in Python!

Here is an example of how I’m using Cacher with Slack: :smile:

Cacher Slack

Usage

Usage: Cacher [options]

Options:
  -h, --help            show this help message and exit
  --targetdate=TARGETDATE
                        Optional: Date to parse. Example: 2017-01-15.
  --logpath=LOGPATH     Optional: Caching Log Path. Defaults to:
                        /Library/Server/Caching/Logs
  --deviceids           Optional: Use Device IDs (Ex: iPhone7,2). Defaults to:
                        False
  --nostdout            Optional: Do not print to standard out
  --configureserver     Optional: Configure Server to log Client Data
  --serveralert         Optional: Send Server Alert
  --slackalert          Optional: Use Slack
  --slackwebhook=SLACKWEBHOOK
                        Optional: Slack Webhook URL. Requires Slack Option.
  --slackusername=SLACKUSERNAME
                        Optional: Slack username. Defaults to Cacher.Requires
                        Slack Option.
  --slackchannel=SLACKCHANNEL
                        Optional: Slack channel. Can be username or channel
                        Ex. #channel or @username. Requires Slack Option.

For more information on how to use these features, please see the official ReadMe.

Changes that may impact you.

The biggest things that could impact you are the following:

  • Server 5.2 or higher is required
  • The server alert is no longer included by default. You must use the --serveralert option.

For people that are curious as to why I removed the server alert, it was due to root/sudo permissions. With this being an option, Cacher can now be run as a standard user. I think that’s a better approach especially in conjunction with the Slack alerts (which I personally find more helpful than the e-mail alerts.)

Why didn’t you merge with Sashay?

I never merged my code with Allister’s for a few reasons:

  • The name was terrible (yes, I’m petty)
  • I didn’t like some of the features and how it different from Cacher.
  • It was going to be a significant amount of effort to have two competing tools have the functionality that each one of us envisioned.

It’s finally done.

The Cacher rewrite took a good 3 days to write and it more than likely wouldn’t have been possible without Michael Lynn’s original inspiration.

While there are things I’m not proud of in the current refactor, there are things that I’m really happy about. I hope sometime soon I’ll have time to refactor this some more and reduce the amount of repeated code.

Conclusion

While I’m sure there are edge cases to work through, I look forward to people using the new version and giving feedback. Here’s to starting off 2017 in a great way.

Table Of Contents