I want to save / load instances of my classes using NSCoding. Each class should have an individual cache time / time to live. When the app starts up I want the instance of my class to be either loaded from cache if its not expired or otherwise created normally.
This problem must have been solved hundreds of times….
Is there a good framework for doing this, or should I roll my own?
To be clear, you can save or loading objects, not classes, using
NSCoding.I’m not aware of a framework that does this. You can either use the file modification time as the cache time or you can keep it in a separate database. If it’s not too many different classes, you can use
NSUserDefaultsas that separate database. Each class would just be coded to know its own time to live.