WeCreativez WhatsApp Support
Nuestro equipo de soporte está disponible para responder.
Hola, ¿podemos ayudarte?

Invalidate Picasso cache remotely

I’m currently working on a commuter app (Madrid Metro|Bus|Cercanias) that allows you to browse among more than 1000 bus line maps (.png files).

Obviously instead of shipping 500MB .png files within the apk I’m hosting these files on Amazon Simple Storage Service (aka Amazon S3) and the app just downloads and caches the images on the device upon user request thanks to the Picasso library for Android.

But what happens when any of these maps are replaced in S3 by a new version?

  1. When the map is not cached:
    User requests map of line let’s say 123, Picasso checks its cache and as the .png is not there an internet request will be executed and the last version from S3 downloaded (and cached). Fine 🙂
  2. When the map is already cached:
    User requests map of line 123, Picasso checks its cache and there is a .png file already cached, then it will be used directly without requesting the new one that is available at S3. User is seeing an old version. Terrible! :S

Read more…

Add a Comment

Your email address will not be published. Required fields are marked *

two × 2 =