检查映像是否在缓存中-Universal Image Loader [英] Check if Image is in Cache - Universal Image Loader
本文介绍了检查映像是否在缓存中-Universal Image Loader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想标题说明了一切.我尝试过:
I guess the title says it all. I tried:
imageLoader.getMemoryCache().get(key);
以图片uri作为键,但它始终返回 null
with the image uri as key, but it always return null
尽管我在配置中启用了缓存.
although I enabled caching in the config.
推荐答案
使用 MemoryCacheUtils
.
MemoryCacheUtils.findCachedBitmapsForImageUri(imageUri, ImageLoader.getInstance().getMemoryCache());
内存缓存可以为一个图像包含几个位图(不同大小).因此,内存缓存使用特殊键,而不是图像URL.
Memory cache can contain several bitmaps (diffenrent sizes) for one image. So memory cache use special keys, not image urls.
这篇关于检查映像是否在缓存中-Universal Image Loader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文