问题
I'm looking into a fairly simple mechanism for caching and and currently using NSCache (for the reason of memory management). Question is - does the cache persist between launches? It seems like no to me.
I get objects put in cache just fine and can take them out of the cache while the app is running no problem. But once I relaunch, seems like the cache is gone.
So is there a way to make the cache persist between launches? If so, how would you re-sync the cache from previous session to the current?
回答1:
NSCache
does not persist between launches- if you'd like to save the cache, I'd recommend simply saving the data using CoreData
- although if memory management is an issue, then perhaps you'd be saving too much. It truly depends on what you're developing.
来源:https://stackoverflow.com/questions/13497678/does-nscache-persist-between-launches