package android.util; import java.util.LinkedHashMap; import java.util.Map; /** * A cache that holds strong references to a limited number of values. Each time * a value is accessed, it is moved to the head of a queue. When a value is * added to a fu…
以下针对 Android API 26 版本的源码进行分析. 在了解LruCache之前,最好对LinkedHashMap有初步的了解,LruCache的实现主要借助LinkedHashMap.LinkedHashMap的源码解析,可阅读Java--LinkedHashMap源码解析 概述 LruCahce其 Lru 是 Least Recently Used 的缩写,即最近最少使用,是包含对有限数量值的强引用的缓存.每当一个值被访问,它将被移到队尾.当缓存达到指定的数量时,位于队头的值将被…
本文来源:转载自: http://blog.csdn.net/linghu_java/article/details/8574102 package android.util; import java.util.LinkedHashMap; import java.util.Map; /** * A cache that holds strong references to a limited number of values. Each time * a value is accessed,…