SDWebImage更改cacheMaxCacheAge

时间:2015-02-16 19:46:57

标签: ios sdwebimage

当我使用SDWebImage时,如何更改静态值cacheMaxCacheAge?什么方式好?我需要将图像缓存5分钟。

2 个答案:

答案 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