Invalidate cache in Picasso Invalidate cache in Picasso android android

Invalidate cache in Picasso


In the recent versions of Picasso, there is a new method for invalidate, without any workarounds, so I think that custom PicassoTools class mentioned earlier, is now obsolete in this case

Picasso.with(getActivity()).invalidate(file);


Actually, based on your own answer, 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();    }}

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));


Abort memory cache and disk cache check by indicate memory policy by flag: emoryPolicy.NO_CACHE and NetworkPolicy.NO_CACHE as below code snippet:

   mPicasso.with(mContext)            .load(url)            .memoryPolicy(MemoryPolicy.NO_CACHE )            .networkPolicy(NetworkPolicy.NO_CACHE)            .resize(512, 512)            .error(R.drawable.login)            .noFade()            .into(imageView);