I'm using Picasso lib for loading images. Everything seams to work correctly, but I still have a lot of images traffic to the server. Is there a parameter to the OKHttpClient like max-age to send how often to check for new version of the image? How dose Picasso knows if the image on the server haven't changed? Dose Picasso sends a request to the server every time before decides whether to load it from cache or disk?
I'm using Google app engine for back end and it has cache that gets cleared every 24h (or whatever you set it). And that triggers picasso to reload the images, all thought the images are the same. The only difference after GAE cache is cleared, is that the response is 204 instead of 200(that should not be a problem) but picasso thinks there is a new image. Or there might be something else different after cache gets cleared.
What I did is use only local images .networkPolicy(NetworkPolicy.OFFLINE)
and onError I load the image from internet.
.into(view, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
//reload request
}
});
So If I want to check every 30days for new image, I keep a last update date and reload them from internet otherwise use offline. There might be more efficient way to do it.