Search in sources :

Example 56 with CacheKey

use of com.facebook.cache.common.CacheKey in project BigImageViewer by Piasy.

the class FrescoImageLoader method getCacheFile.

private File getCacheFile(final ImageRequest request) {
    FileCache mainFileCache = ImagePipelineFactory.getInstance().getMainFileCache();
    final CacheKey cacheKey = DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(request, // we don't need context, but avoid null
    false);
    File cacheFile = request.getSourceFile();
    // http://crashes.to/s/ee10638fb31
    if (mainFileCache.hasKey(cacheKey) && mainFileCache.getResource(cacheKey) != null) {
        cacheFile = ((FileBinaryResource) mainFileCache.getResource(cacheKey)).getFile();
    }
    return cacheFile;
}
Also used : File(java.io.File) CacheKey(com.facebook.cache.common.CacheKey) FileCache(com.facebook.cache.disk.FileCache)

Aggregations

CacheKey (com.facebook.cache.common.CacheKey)56 SimpleCacheKey (com.facebook.cache.common.SimpleCacheKey)31 MultiCacheKey (com.facebook.cache.common.MultiCacheKey)29 Test (org.junit.Test)22 PrepareOnlyThisForTest (org.powermock.core.classloader.annotations.PrepareOnlyThisForTest)19 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)13 EncodedImage (com.facebook.imagepipeline.image.EncodedImage)10 ArrayList (java.util.ArrayList)8 CloseableImage (com.facebook.imagepipeline.image.CloseableImage)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 BinaryResource (com.facebook.binaryresource.BinaryResource)5 PooledByteBuffer (com.facebook.common.memory.PooledByteBuffer)5 BitmapMemoryCacheKey (com.facebook.imagepipeline.cache.BitmapMemoryCacheKey)5 File (java.io.File)5 Before (org.junit.Before)5 Uri (android.net.Uri)4 Nullable (javax.annotation.Nullable)4 FileBinaryResource (com.facebook.binaryresource.FileBinaryResource)3 WriterCallback (com.facebook.cache.common.WriterCallback)3 CloseableReference (com.facebook.common.references.CloseableReference)3