毕加索图像库缓存

Dan*_*ali 0 android picasso

我正在使用毕加索来显示图像.我需要时可以强制清除缓存吗?我用谷歌搜索,但我找不到任何解决方案.

谢谢.

sha*_*afi 5

基于这个问题及其自我答案:在Picasso中使缓存无效

有一种更简单的方法可以在不分支库的情况下完成.将此类添加到com.squareup.picasso包中.

package com.squareup.picasso;

public class PicassoTools {

    public static void clearCache (Picasso p) {
        p.cache.clear();
    }
}
Run Code Online (Sandbox Code Playgroud)

由于缓存具有包可见性,因此该util类可以为您清除缓存.你只需要调用它:

PicassoTools.clearCache(Picasso.with(context));
Run Code Online (Sandbox Code Playgroud)