毕加索图像库缓存 [英] Picasso image library cache

查看:149
本文介绍了毕加索图像库缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用毕加索来显示图像。是否有可能迫使清缓存,当我需要什么?我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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆