Poor NSCache, always being overshadowed by
NSMutableDictionary. It's as if no one knew it was there, ready to provide all of that garbage collection behavior that developers take great pains to re-implement themselves.
That's right:Mattt Thompson, NSHipster
NSCacheis basically just an
NSMutableDictionarythat automatically evicts objects in order to free up space in memory as needed. No need to respond to memory warnings or contrive a cache-clearing timer mechanism. The only other difference is that keys aren't copied as they are in an
NSMutableDictionary, which is actually to its advantage (no need for keys to conform to
NSCopying). If developers only knew...
Myself included. Todo: Rewrite Streetmate timeline caching using