How to invalidate Glide cache for some specific images

北慕城南 提交于 2019-12-22 08:26:44

问题


I'm writing an app which needs to load a lot of images from the internet (a manga reader). I need to cache some thumbnail images for offline use, any others should be cleared when app closed.

I read some about cache invalidation on Glide page, they said the best way is to change the content url, but how Glide know if it is a modified url of old content or a new one? I'm new to Glide here.

https://github.com/bumptech/glide/wiki/Caching-and-Cache-Invalidation

Thank in advance :)


回答1:


You can use following to load image:

Glide.with(context)
    .signature(new StringSignature(yourVersionMetadata))
    .into(imageView)

Just change yourVersionMetadata when you load image and it will not load from cache if yourVersionMetadata is different.



来源:https://stackoverflow.com/questions/31537669/how-to-invalidate-glide-cache-for-some-specific-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!