
我也想在启动之间保留缓存,所以我需要将缓存数据写入磁盘.有没有一个简单的方法来保存NSCache内容到pList或什么?有没有更好的方法来完成这个使用NSCache以外的东西?
这个应用程序将在iPhone上,所以我只需要在iOS 4中可用的类,而不仅仅是OS X.
谢谢!
解决方法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?
你几乎只是描述了CoreData做了什么;具有清除和修剪功能的对象图的持久性.
NSCache不是为了协助持久化而设计的.
鉴于您建议持续使用pList格式,所以使用Core Data而不是概念上的差异.
总结以上是内存溢出为你收集整理的iphone – 将NSCache内容保存到磁盘全部内容,希望文章能够帮你解决iphone – 将NSCache内容保存到磁盘所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)