Package com.bumptech.glide.load.engine
Class DiskCacheStrategy
- java.lang.Object
-
- com.bumptech.glide.load.engine.DiskCacheStrategy
-
public abstract class DiskCacheStrategy extends java.lang.ObjectSet of available caching strategies for media.
-
-
Field Summary
Fields Modifier and Type Field Description static DiskCacheStrategyALLstatic DiskCacheStrategyAUTOMATICTries to intelligently choose a strategy based on the data source of theDataFetcherand theEncodeStrategyof theResourceEncoder(if anResourceEncoderis available).static DiskCacheStrategyDATAWrites retrieved data directly to the disk cache before it's decoded.static DiskCacheStrategyNONESaves no data to cache.static DiskCacheStrategyRESOURCEWrites resources to disk after they've been decoded.
-
Constructor Summary
Constructors Constructor Description DiskCacheStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract booleandecodeCachedData()Returns true if this request should attempt to decode cached source data.abstract booleandecodeCachedResource()Returns 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 Detail
-
ALL
public static final DiskCacheStrategy ALL
-
NONE
public static final DiskCacheStrategy NONE
Saves no data to cache.
-
DATA
public static final DiskCacheStrategy DATA
Writes retrieved data directly to the disk cache before it's decoded.
-
RESOURCE
public static final DiskCacheStrategy RESOURCE
Writes resources to disk after they've been decoded.
-
AUTOMATIC
public static final DiskCacheStrategy AUTOMATIC
Tries to intelligently choose a strategy based on the data source of theDataFetcherand theEncodeStrategyof theResourceEncoder(if anResourceEncoderis available).
-
-
Method Detail
-
isDataCacheable
public abstract boolean isDataCacheable(DataSource dataSource)
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.
-
-