一般android会采用缓存机制,内存缓存采用LruCache,存储缓存采用DiskLruCache
LruCache内部维护了一个LinkedHashMap

 /**     * @param maxSize for caches that do not override {@link #sizeOf}, this is     *     the maximum number of entries in the cache. For all other caches,     *     this is the maximum sum of the sizes of the entries in this cache.     */    public LruCache(int maxSize) {        if (maxSize <= 0) {            throw new IllegalArgumentException("maxSize <= 0");        }        this.maxSize = maxSize;        this.map = new LinkedHashMap(0, 0.75f, true);    }

同时是线程安全的

   synchronized (this) {            mapValue = map.get(key);            if (mapValue != null) {                hitCount++;                return mapValue;            }            missCount++;        }   synchronized (this) {            createCount++;            mapValue = map.put(key, createdValue);            if (mapValue != null) {                // There was a conflict so undo that last put                map.put(key, mapValue);            } else {                size += safeSizeOf(key, createdValue);            }        }

一般存储空间为当前运行空间的1/8 单位为KB
LruCache 3.1以后源码可见
DiskLruCache 一般存储空间为50M key采用url经过Md5加密,防止url中的特殊字符,value为bitmap,对外提供get,put方法

更多相关文章

  1. [置顶] 我的Android进阶之旅------>android异步加载图片显示,并且
  2. 【Android开源项目分析】android轻量级开源缓存框架——ASimpleC
  3. Android图片下载缓存库picasso解析
  4. Android图片下载缓存库picasso解析
  5. trinea博客地址
  6. android 4.4 webview加载部分https网页白屏
  7. Android(安卓)使用finalBitmap实现缓存读取
  8. android使用util工具包
  9. 【从头学android】在两个Activity之间实现界面切换

随机推荐

  1. Android也谈android和多屏幕适配
  2. 基于android Material Design基础框架搭
  3. Android官方架构组件Paging-Ex:为分页列
  4. Android导入第三方静态库.a编译成动态库.
  5. android studio中svn的使用(关联svn、svn
  6. Android 使用Ant编译Android 工程
  7. Activity 之间通信
  8. Android定制权限重名引起的问题
  9. Android Canvas练习(2)自已绘饼图(Pie Ch
  10. Android图形系统的分析与移植--二、Andro