最大空间:
Glide的内存缓存其实涉及到比较多的计算,这里就介绍最重要的一个参数,就是内存缓存最大空间
内存缓存最大空间(maxSize)=每个进程可用的最大内存 * 0.4
(低配手机的话是: 每个进程可用的最大内存 * 0.33)
磁盘缓存大小
磁盘缓存大小: 250 * 1024 * 1024(250MB)
/** 250 MB of cache. */
int DEFAULT_DISK_CACHE_SIZE = 250 * 1024 * 1024;
磁盘缓存目录
磁盘缓存目录: 项目/cache/image_manager_disk_cache
String DEFAULT_DISK_CACHE_DIR = “image_manager_disk_cache”;
5、清除缓存
由于Glide可能会缓存一张图片的多个分辨率的图片,并且文件名是被哈希过的,所以并不能很好的删除单个资源的缓存,以下是官方文档中的描述
Because File names are hashed keys, there is no good way to simply delete all of the cached files on disk that correspond to a particular url or file path. The problem would be simpler if you were only ever allowed to load
or cache the original image, but since Glide also caches thumbnails and provides various transformations, each of which will result in a new File in the cache, tracking down an