Save NSCache Contents to Disk
- by Cory Imdieke
I'm writing an app that needs to keep an in-memory cache of a bunch of objects, but that doesn't get out of hand so I'm planning on using NSCache to store it all. Looks like it will take care of purging and such for me, which is fantastic.
I'd also like to persist the cache between launches, so I need to write the cache data to disk. Is there an easy way to save the NSCache contents to a plist or something? Are there perhaps better ways to accomplish this using something other than NSCache?
This app will be on the iPhone, so I'll need only classes that are available in iOS 4+ and not just OS X.
Thanks!