Does NSCache persist between launches?

大兔子大兔子 提交于 2019-12-23 17:56:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!