What happens if NSURLCache is full?

岁酱吖の 提交于 2019-12-10 19:56:00

问题


I'm using default NSURLCache to cache images in my iPhone app. What will happen if the cache is full and i'll try to cache another image?

Will it not cache the image? or it will be replaced with the oldest image cached?

Thanks alot


回答1:


The maximum cache can be influenced with the initialization initWithMemoryCapacity:... diskCapacity:... diskPath:..] The new file will always be downloaded. (except when it's bigger than the maximum memory capacity, then it will just be downloaded and not saved in the cache) If the maximum cache size is reached other file(s) will be removed. It is not specified what files will be removed. It's not difficult to create your own NSUrlCache and handle it yourself. if you want to see a sample how to do that, then have a look at https://github.com/evermeer/EVURLCache



来源:https://stackoverflow.com/questions/15903832/what-happens-if-nsurlcache-is-full

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