如何为无效一些特定的图像缓存滑翔 [英] How to invalidate Glide cache for some specific images
问题描述
我写这需要从互联网(一个漫画阅读器)加载大量的图片的应用程序。我需要缓存以供离线使用一些缩略图,当应用程序关闭任何其他人应被清除。
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.
我读了一些关于滑翔页面缓存失效,他们说,最好的办法是改变内容的URL,但如何滑翔知道这是否是旧内容或新修改后的网址是什么?我是新来这里下滑。
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/高速缓存和数据缓存的无效
感谢提前:)
推荐答案
您可以使用Glide.with(上下文)的.signature(新StringSignature(yourVersionMetadata))。到(ImageView的)来加载图像。
You can use Glide.with(context).signature(new StringSignature(yourVersionMetadata)).into(imageView) to load image.
只要改变的 yourVersionMetadata em>的当你加载图像,如果的 yourVersionMetadata em>的不同,它不会从缓存中加载。
Just change yourVersionMetadata when you load image and it will not load from cache if yourVersionMetadata is different.
这篇关于如何为无效一些特定的图像缓存滑翔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!