Package com.bumptech.glide.load.engine
Class DiskCacheStrategy
java.lang.Object
com.bumptech.glide.load.engine.DiskCacheStrategy
Set of available caching strategies for media.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DiskCacheStrategystatic final DiskCacheStrategyTries to intelligently choose a strategy based on the data source of theDataFetcherand theEncodeStrategyof theResourceEncoder(if anResourceEncoderis available).static final DiskCacheStrategyWrites retrieved data directly to the disk cache before it's decoded.static final DiskCacheStrategySaves no data to cache.static final DiskCacheStrategyWrites resources to disk after they've been decoded. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanReturns true if this request should attempt to decode cached source data.abstract booleanReturns true if this request should attempt to decode cached resource data.abstract booleanisDataCacheable(DataSource dataSource) Returns true if this request should cache the original unmodified data.abstract booleanisResourceCacheable(boolean isFromAlternateCacheKey, DataSource dataSource, EncodeStrategy encodeStrategy) Returns true if this request should cache the final transformed resource.
-
Field Details
-
ALL
-
NONE
Saves no data to cache. -
DATA
Writes retrieved data directly to the disk cache before it's decoded. -
RESOURCE
Writes resources to disk after they've been decoded. -
AUTOMATIC
Tries to intelligently choose a strategy based on the data source of theDataFetcherand theEncodeStrategyof theResourceEncoder(if anResourceEncoderis available).
-
-
Constructor Details
-
DiskCacheStrategy
public DiskCacheStrategy()
-
-
Method Details
-
isDataCacheable
Returns true if this request should cache the original unmodified data.- Parameters:
dataSource- Indicates where the data was originally retrieved.
-
isResourceCacheable
public abstract boolean isResourceCacheable(boolean isFromAlternateCacheKey, DataSource dataSource, EncodeStrategy encodeStrategy) Returns true if this request should cache the final transformed resource.- Parameters:
isFromAlternateCacheKey-trueif 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- TheEncodeStrategytheResourceEncoderwill use to encode the resource.
-
decodeCachedResource
public abstract boolean decodeCachedResource()Returns true if this request should attempt to decode cached resource data. -
decodeCachedData
public abstract boolean decodeCachedData()Returns true if this request should attempt to decode cached source data.
-