public class DiskLruCacheFactory extends Object implements DiskCache.Factory
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, long)
constructor variant.
Modifier and Type | Class and Description |
---|---|
static interface |
DiskLruCacheFactory.CacheDirectoryGetter
Interface called out of UI thread to get the cache folder.
|
DEFAULT_DISK_CACHE_DIR, DEFAULT_DISK_CACHE_SIZE
Constructor and Description |
---|
DiskLruCacheFactory(DiskLruCacheFactory.CacheDirectoryGetter cacheDirectoryGetter,
long 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,
long diskCacheSize) |
DiskLruCacheFactory(String diskCacheFolder,
String diskCacheName,
long diskCacheSize) |
Modifier and Type | Method and Description |
---|---|
DiskCache |
build()
Returns a new disk cache, or
null if no disk cache could be created. |
public DiskLruCacheFactory(String diskCacheFolder, long diskCacheSize)
public DiskLruCacheFactory(String diskCacheFolder, String diskCacheName, long diskCacheSize)
public DiskLruCacheFactory(DiskLruCacheFactory.CacheDirectoryGetter cacheDirectoryGetter, long diskCacheSize)
DiskLruCacheFactory.CacheDirectoryGetter.getCacheDirectory()
will be called out
of UI thread, allowing to do I/O access without performance impacts.cacheDirectoryGetter
- Interface called out of UI thread to get the cache folder.diskCacheSize
- Desired max bytes size for the LRU disk cache.public DiskCache build()
DiskCache.Factory
null
if no disk cache could be created.build
in interface DiskCache.Factory