Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear Picasso's cache for a specific url?

I'm trying to find out how can I clear cache of a specific URL or make Picasso notice for the server side's image change. Can someone help me with this?

like image 368
reza Avatar asked Sep 09 '14 23:09

reza


2 Answers

Jake Wharton replied on Dec 12, 2014 that the best candidate solution to be in 2.5 milestone is:

picasso.load('http://example.com/')
  .cachePolicy(NO_CACHE, NO_STORE)
  .networkPolicy(NO_CACHE, NO_STORE, OFFLINE)
  .into(imageView);

enum MemoryPolicy {
  NO_CACHE, NO_STORE
}
enum NetworkPolicy {
  NO_CACHE, NO_STORE, OFFLINE
}

update

or now you can use:

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

as answered by mes in this answer

like image 71
AbdelHady Avatar answered Nov 09 '22 00:11

AbdelHady


Answer from Jake Wharton.

You can't [do this]. But we're going to add it: github.com/square/picasso/issues/438

like image 37
halfer Avatar answered Nov 09 '22 00:11

halfer