当我使用SDWebImage时,如何更改静态值cacheMaxCacheAge
?什么方式好?我需要将图像缓存5分钟。
答案 0 :(得分:0)
SDWebImage提供maxCacheAge
属性来设置最大缓存时间(以秒为单位)。我们可以使用共享实例方法来访问此属性。
[SDImageCache sharedImageCache].config.maxCacheAge = 60 * 5; //5 minutes
答案 1 :(得分:0)
在 SDWebImage 5.0 + 中,maxCacheAge重命名为maxDiskAge。您可以这样设置最大缓存时间(秒)。
Objetive-c
int isMeasurement = getIntent().getIntExtra("isMeasurement",0); // Here 0 is a default value.It could be anything acc to your requirement
快速4 +
[SDImageCache sharedImageCache].config.maxDiskSize = 60 * 5; //5 minutes
参考链接:https://github.com/SDWebImage/SDWebImage/wiki/5.0-Migration-guide