Support removing / evicting images from disk cache
The picture on the server changed, but fresco still load the old one, I tried the code Fresco.getImagePipeline().evictFromMemoryCache(uri);, but it not work. Does it only clear the memory cache? If so, how to clear the disk cache?
We don't expose that functionality yet, but that shouldn't be hard to support.
I also have this same issue, it would be great to have something to clear the local cache manually or set some expiration time.
There is an expiration time for disk cache. If I remember correctly it is set to 60 days.
There are other things on our priority list at the moment, but if one of you sends a pull request for adding evictFromDiskCache we will take a look.
I will try to do something in my free time.. But from now, I can use: Uri uri = Uri.parse("http://frescolib.org/static/fresco-logo.png"); Fresco.getImagePipelineFactory().getMainDiskStorageCache().remove(new CacheKey(uri.toString())); Fresco.getImagePipelineFactory().getSmallImageDiskStorageCache().remove(new CacheKey(uri.toString()));
This remove from local cache.. I don't know the unexpected behavior that this will cause.
@danilobertelli , yeah this should work. We should simplify the API though (like we have for removing from memory cache).
Also, one thing to watch out for is when using a custom CacheKeyFactory (unlikely, but possible). The default one does what you do, so if the default one is used, it hsould be fine. https://github.com/facebook/fresco/blob/847851a8de6d223c0a6634447bddee1252e01c64/imagepipeline/src/main/java/com/facebook/imagepipeline/cache/DefaultCacheKeyFactory.java
Added in v0.6.0. See http://frescolib.org/docs/caching.html#evicting-from-cache