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, int)
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,
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) |
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, int diskCacheSize)
public DiskLruCacheFactory(String diskCacheFolder, String diskCacheName, int diskCacheSize)
public DiskLruCacheFactory(DiskLruCacheFactory.CacheDirectoryGetter cacheDirectoryGetter, int 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