如果NSURLCache已满怎么办?

编程入门 行业动态 更新时间:2024-10-28 12:26:46
本文介绍了如果NSURLCache已满怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用默认的NSURLCache在iPhone应用程序中缓存图像. 如果缓存已满,我将尝试缓存另一个图像会发生什么情况?

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?

非常感谢

推荐答案

初始化可能会影响最大缓存 initWithMemoryCapacity:... diskCapacity:... diskPath:..] 新文件将始终被下载. (除非它大于最大内存容量,否则它将仅被下载而不保存在缓存中) 如果达到最大高速缓存大小,则将删除其他文件. 没有指定要删除的文件. 创建自己的NSUrlCache并自己处理它并不难. 如果您想查看一个示例,请查看 github/evermeer/EVURLCache

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 github/evermeer/EVURLCache

更多推荐

如果NSURLCache已满怎么办?

本文发布于:2023-07-09 14:53:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1087118.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:已满   NSURLCache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!