EGOCache 2.0

It’s been a while since we’ve updated EGOCache, a large reason for that is that it’s been fairly stable and gets the job done.  There’s not too many bells and whistles you can build into a key value cache store, at least not many that are necessary, so we’ve left things largely alone.  Aside from a few pull requests, not much has changed in EGOCache since we released in October 2009.

So, what’s new in 2.0? Everything. Nothing.

Internally, 2.0 is completely rearchitectured/rewritten.  Externally, the API remains largely untouched, so you’ll be able to drop it into your existing projects and go.

The only major API change is that +currentCache has been deprecated in favor of +globalCache.  This was made purely for semantics, because you can now instantiate your own EGOCache instances and set a different cache directory if you’d like.  This could be useful if you’d like to divide caches for different items (photos vs UI caching).

Under the hood is where all the fun stuff c:

  • EGOCache 2.0 is now built entirely on ARC, Objective-C blocks and libdispatch.  If your projects don’t support these technologies, well, do yourself a favor, learn them and love them.  We were resistant to ARC at first too, just give in ;).
  • All disk saves are now non blocking and processed in a separate dispatch queue.
  • The thread saftey issues that popped up over the last year should be resolved.  All dictionary modifications are now done in a serial dispatch queue.
  • On iOS, when saving a UIImage, EGOCache now serializes the UIImage instance rather than the old way of using UIImagePNGRepresentation.  This allows you to retain all meta information associated with the object, such as orientation and scale.  An additional benefit to this is that the image is saved in it’s original format, so JPEG’s are no longer bloated to PNG size when saved.  One downside to this, if for some reason you were retrieving images via -dataForKey:, that will no longer work.

This is absolutely NOT a beta release.  We’ve been shipping this code on App Store since August and it’s running on millions of devices, so feel confident in switching to it from 1.0.

Grab the code here: https://github.com/enormego/EGOCache

Lastly, I wanted to add a quick update on the rest of our open source libraries:

We still use them, every day.  We’ve been evolving them over the years and they’re all rewritten to utilize the same technologies mentioned above, and will be updated soon.  We don’t take major updates lightly, and we’re not going to put them out there until we’ve already shipped them in our own apps and know for certain they’re rock solid.  Look for EGOHTTPRequest 2.0 in the next few weeks.

Notes

  1. egocode posted this