public abstract class DiskCacheStrategy extends Object
Modifier and Type | Field and Description |
---|---|
static DiskCacheStrategy |
ALL
|
static DiskCacheStrategy |
AUTOMATIC
Tries to intelligently choose a strategy based on the data source of the
DataFetcher and the
EncodeStrategy of the
ResourceEncoder (if an
ResourceEncoder is available). |
static DiskCacheStrategy |
DATA
Writes retrieved data directly to the disk cache before it's decoded.
|
static DiskCacheStrategy |
NONE
Saves no data to cache.
|
static DiskCacheStrategy |
RESOURCE
Writes resources to disk after they've been decoded.
|
Constructor and Description |
---|
DiskCacheStrategy() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
decodeCachedData()
Returns true if this request should attempt to decode cached source data.
|
abstract boolean |
decodeCachedResource()
Returns true if this request should attempt to decode cached resource data.
|
abstract boolean |
isDataCacheable(DataSource dataSource)
Returns true if this request should cache the original unmodified data.
|
abstract boolean |
isResourceCacheable(boolean isFromAlternateCacheKey,
DataSource dataSource,
EncodeStrategy encodeStrategy)
Returns true if this request should cache the final transformed resource.
|
public static final DiskCacheStrategy ALL
public static final DiskCacheStrategy NONE
public static final DiskCacheStrategy DATA
public static final DiskCacheStrategy RESOURCE
public static final DiskCacheStrategy AUTOMATIC
DataFetcher
and the
EncodeStrategy
of the
ResourceEncoder
(if an
ResourceEncoder
is available).public abstract boolean isDataCacheable(DataSource dataSource)
dataSource
- Indicates where the data was originally retrieved.public abstract boolean isResourceCacheable(boolean isFromAlternateCacheKey, DataSource dataSource, EncodeStrategy encodeStrategy)
isFromAlternateCacheKey
- true
if the resource we've decoded was loaded using an
alternative, rather than the primary, cache key.dataSource
- Indicates where the data used to decode the resource was originally
retrieved.encodeStrategy
- The EncodeStrategy
the ResourceEncoder
will use to encode the resource.public abstract boolean decodeCachedResource()
public abstract boolean decodeCachedData()