Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Picasso disk caching

I am using Picasso to load images from a URL

Picasso.with(getApplicationContext()).load(product.getImageUrl()).into(imageView);

From what I can see this is going to the url everytime and not caching to disk. I need disk caching enabled

I have permissions

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

So its not a issue with disk. I think the issue is that the server is not sending back a cache param so HTTP Client is not caching.

How can I force Picasso use the disk cache at all times?

like image 332
user2859250 Avatar asked Oct 21 '22 18:10

user2859250


1 Answers

Picasso doesn't have a disk cache. The library relies on HTTP clients to honor the semantics of the very well-defined caching headers for keeping things locally on disk.

Because of this fact, there is no way to force caching.

like image 187
Jake Wharton Avatar answered Oct 24 '22 06:10

Jake Wharton