com.bumptech.glide.load.engine.cache
Class DiskLruCacheFactory

java.lang.Object
  extended by com.bumptech.glide.load.engine.cache.DiskLruCacheFactory
All Implemented Interfaces:
DiskCache.Factory
Direct Known Subclasses:
ExternalCacheDiskCacheFactory, InternalCacheDiskCacheFactory

public class DiskLruCacheFactory
extends Object
implements DiskCache.Factory

Creates an DiskLruCache based disk cache in the specified disk cache directory.

If you need to make I/O access before returning the cache directory use the DiskLruCacheFactory(CacheDirectoryGetter, int) constructor variant.


Nested Class Summary
static interface DiskLruCacheFactory.CacheDirectoryGetter
          Interface called out of UI thread to get the cache folder.
 
Field Summary
 
Fields inherited from interface com.bumptech.glide.load.engine.cache.DiskCache.Factory
DEFAULT_DISK_CACHE_DIR, DEFAULT_DISK_CACHE_SIZE
 
Constructor Summary
DiskLruCacheFactory(DiskLruCacheFactory.CacheDirectoryGetter cacheDirectoryGetter, int diskCacheSize)
          When using this constructor DiskLruCacheFactory.CacheDirectoryGetter.getCacheDirectory() will be called out of UI thread, allowing to do I/O access without performance impacts.
DiskLruCacheFactory(String diskCacheFolder, int diskCacheSize)
           
DiskLruCacheFactory(String diskCacheFolder, String diskCacheName, int diskCacheSize)
           
 
Method Summary
 DiskCache build()
          Returns a new disk cache, or null if no disk cache could be created.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskLruCacheFactory

public DiskLruCacheFactory(String diskCacheFolder,
                           int diskCacheSize)

DiskLruCacheFactory

public DiskLruCacheFactory(String diskCacheFolder,
                           String diskCacheName,
                           int diskCacheSize)

DiskLruCacheFactory

public DiskLruCacheFactory(DiskLruCacheFactory.CacheDirectoryGetter cacheDirectoryGetter,
                           int diskCacheSize)
When using this constructor DiskLruCacheFactory.CacheDirectoryGetter.getCacheDirectory() will be called out of UI thread, allowing to do I/O access without performance impacts.

Parameters:
cacheDirectoryGetter - Interface called out of UI thread to get the cache folder.
diskCacheSize - Desired max bytes size for the LRU disk cache.
Method Detail

build

public DiskCache build()
Description copied from interface: DiskCache.Factory
Returns a new disk cache, or null if no disk cache could be created.

Specified by:
build in interface DiskCache.Factory