net.tsz.afinal.bitmap.core
类 BitmapCache

java.lang.Object
  继承者 net.tsz.afinal.bitmap.core.BitmapCache

public class BitmapCache
extends java.lang.Object


嵌套类摘要
static class BitmapCache.ImageCacheParams
          A holder class that contains cache parameters.
 
构造方法摘要
BitmapCache(BitmapCache.ImageCacheParams cacheParams)
          Creating a new ImageCache object using the specified parameters.
 
方法摘要
 void addBitmapToCache(java.lang.String data, Bitmap bitmap)
          Adds a bitmap to both memory and disk cache.
 void clearCache()
          Clears both the memory and disk cache associated with this ImageCache object.
 void close()
          Closes the disk cache associated with this ImageCache object.
 void flush()
          Flushes the disk cache associated with this ImageCache object.
 Bitmap getBitmapFromDiskCache(java.lang.String data)
          获取硬盘缓存
 Bitmap getBitmapFromMemCache(java.lang.String data)
          Get from memory cache.
 void initDiskCache()
          Initializes the disk cache.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

BitmapCache

public BitmapCache(BitmapCache.ImageCacheParams cacheParams)
Creating a new ImageCache object using the specified parameters.

参数:
cacheParams - The cache parameters to use to initialize the cache
方法详细信息

initDiskCache

public void initDiskCache()
Initializes the disk cache. Note that this includes disk access so this should not be executed on the main/UI thread. By default an ImageCache does not initialize the disk cache when it is created, instead you should call initDiskCache() to initialize it on a background thread.


addBitmapToCache

public void addBitmapToCache(java.lang.String data,
                             Bitmap bitmap)
Adds a bitmap to both memory and disk cache.

参数:
data - Unique identifier for the bitmap to store
bitmap - The bitmap to store

getBitmapFromMemCache

public Bitmap getBitmapFromMemCache(java.lang.String data)
Get from memory cache.

参数:
data - Unique identifier for which item to get
返回:
The bitmap if found in cache, null otherwise

getBitmapFromDiskCache

public Bitmap getBitmapFromDiskCache(java.lang.String data)
获取硬盘缓存

参数:
data -
返回:

clearCache

public void clearCache()
Clears both the memory and disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread.


flush

public void flush()
Flushes the disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread.


close

public void close()
Closes the disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread.