毕加索图像库缓存 [英] Picasso image library cache
问题描述
我使用毕加索来显示图像。是否有可能迫使清缓存,当我需要什么?我GOOGLE了它,但我找不到任何解决方案。
I'm using Picasso to display images. Is it possible to force clear the cache when I need? I googled it but I cannot find any solution.
感谢您。
推荐答案
在此基础上的其他问题和自身的答案:<一href=\"http://stackoverflow.com/questions/22016382/invalidate-cache-in-picasso/23544650#23544650\">Invalidate缓存毕加索
Based on this other question and its self answer: Invalidate cache in Picasso
有一个更简单的方式做到这一点不分叉库中。这个类添加到com.squareup.picasso包。
There is an easier way to do it without forking the library. Add this class to the com.squareup.picasso package.
package com.squareup.picasso;
public class PicassoTools {
public static void clearCache (Picasso p) {
p.cache.clear();
}
}
由于缓存有包可见,这个UTIL类可以清除缓存为您服务。你只需要调用它:
Because cache has package visibility, this util class can clear the cache for you. You just have to call it:
PicassoTools.clearCache(Picasso.with(context));
这篇关于毕加索图像库缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!