Using Instruments to Learn About NSCache

I recently came across the Foundation class NSCache, which was introduced in Mac OS X 10.6 and now in iOS 4. NSCache is a key-value store with an API similar to NSDictionary, except that it will automatically evict objects from its store when the 'cost' (however defined) of the cache rise above a configurable threshold.

Instead of writing a thousand words about using Instruments to explore the behaviour of a class, I decided to make a screencast instead so here, in six minutes, is a quick discussion of NSCache and an example of using Instruments to explore its behaviour in terms of memory footprint.

PS: this is a small size to fit on the blog. It might be better to watch a larger version at YouTube.