public class

SplitCachesByImageSizeDiskCachePolicy

extends Object
implements DiskCachePolicy
java.lang.Object
   ↳ com.facebook.imagepipeline.cache.SplitCachesByImageSizeDiskCachePolicy

Class Overview

Task factory to attempt to load an image from either the main or small disk cache and then fallback to the other if the first attempt was unsuccessful.

Summary

Public Constructors
SplitCachesByImageSizeDiskCachePolicy(BufferedDiskCache defaultBufferedDiskCache, BufferedDiskCache smallImageBufferedDiskCache, CacheKeyFactory cacheKeyFactory, int forceSmallCacheThresholdBytes)
Public Methods
Task<EncodedImage> createAndStartCacheReadTask(ImageRequest imageRequest, Object callerContext, AtomicBoolean isCancelled)
Creates and starts the task to carry out a disk cache read, using whichever caches and keys are appropriate for this policy.
ImageRequest.CacheChoice getCacheChoiceForResult(ImageRequest imageRequest, EncodedImage encodedImage)
Determines the cache in which to store the provided image.
void writeToCache(EncodedImage newResult, ImageRequest imageRequest, Object callerContext)
Writes the new image data to whichever cache and with whichever key is appropriate for this policy.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.imagepipeline.cache.DiskCachePolicy

Public Constructors

public SplitCachesByImageSizeDiskCachePolicy (BufferedDiskCache defaultBufferedDiskCache, BufferedDiskCache smallImageBufferedDiskCache, CacheKeyFactory cacheKeyFactory, int forceSmallCacheThresholdBytes)

Public Methods

public Task<EncodedImage> createAndStartCacheReadTask (ImageRequest imageRequest, Object callerContext, AtomicBoolean isCancelled)

Creates and starts the task to carry out a disk cache read, using whichever caches and keys are appropriate for this policy.

public ImageRequest.CacheChoice getCacheChoiceForResult (ImageRequest imageRequest, EncodedImage encodedImage)

Determines the cache in which to store the provided image.

Parameters
imageRequest request which resulted in loading the image
encodedImage the image to store in cache
Returns
  • cache choice that represents the cache to use

public void writeToCache (EncodedImage newResult, ImageRequest imageRequest, Object callerContext)

Writes the new image data to whichever cache and with whichever key is appropriate for this policy.