问题
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