com.facebook.cache.disk.FileCache Java Examples

The following examples show how to use com.facebook.cache.disk.FileCache. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseFrescoStethoPlugin.java    From fresco with MIT License 6 votes vote down vote up
private void diskcache(FileCache cache, String title, PrintStream writer, List<String> args)
    throws DumpException {
  DiskStorage.DiskDumpInfo intDiskDumpInfo;
  try {
    intDiskDumpInfo = cache.getDumpInfo();
  } catch (IOException e) {
    throw new DumpException(e.getMessage());
  }
  if (!args.isEmpty() && args.get(0).equals("-s")) {
    writeDiskDumpInfoScriptReadable(writer, intDiskDumpInfo);
  } else {
    writer.println();
    writer.println(title + " disk cache contents:");
    writeDiskDumpInfo(writer, intDiskDumpInfo);
  }
}
 
Example #2
Source File: BigImageLoader.java    From ImageLoader with Apache License 2.0 5 votes vote down vote up
private File getCacheFile(final ImageRequest request) {
    FileCache mainFileCache = ImagePipelineFactory
            .getInstance()
            .getMainFileCache();
    final CacheKey cacheKey = DefaultCacheKeyFactory
            .getInstance()
            .getEncodedCacheKey(request, false); // we don't need context, but avoid null
    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;
}
 
Example #3
Source File: BufferedDiskCache.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
public BufferedDiskCache(
    FileCache fileCache,
    PooledByteBufferFactory pooledByteBufferFactory,
    PooledByteStreams pooledByteStreams,
    Executor readExecutor,
    Executor writeExecutor,
    ImageCacheStatsTracker imageCacheStatsTracker) {
  mFileCache = fileCache;
  mPooledByteBufferFactory = pooledByteBufferFactory;
  mPooledByteStreams = pooledByteStreams;
  mReadExecutor = readExecutor;
  mWriteExecutor = writeExecutor;
  mImageCacheStatsTracker = imageCacheStatsTracker;
  mStagingArea = StagingArea.getInstance();
}
 
Example #4
Source File: BufferedDiskCache.java    From fresco with MIT License 5 votes vote down vote up
public BufferedDiskCache(
    FileCache fileCache,
    PooledByteBufferFactory pooledByteBufferFactory,
    PooledByteStreams pooledByteStreams,
    Executor readExecutor,
    Executor writeExecutor,
    ImageCacheStatsTracker imageCacheStatsTracker) {
  mFileCache = fileCache;
  mPooledByteBufferFactory = pooledByteBufferFactory;
  mPooledByteStreams = pooledByteStreams;
  mReadExecutor = readExecutor;
  mWriteExecutor = writeExecutor;
  mImageCacheStatsTracker = imageCacheStatsTracker;
  mStagingArea = StagingArea.getInstance();
}
 
Example #5
Source File: ImagePipelineFactory.java    From fresco with MIT License 5 votes vote down vote up
public FileCache getMainFileCache() {
  if (mMainFileCache == null) {
    DiskCacheConfig diskCacheConfig = mConfig.getMainDiskCacheConfig();
    mMainFileCache = mConfig.getFileCacheFactory().get(diskCacheConfig);
  }
  return mMainFileCache;
}
 
Example #6
Source File: ImagePipelineFactory.java    From fresco with MIT License 5 votes vote down vote up
public FileCache getSmallImageFileCache() {
  if (mSmallImageFileCache == null) {
    DiskCacheConfig diskCacheConfig = mConfig.getSmallImageDiskCacheConfig();
    mSmallImageFileCache = mConfig.getFileCacheFactory().get(diskCacheConfig);
  }
  return mSmallImageFileCache;
}
 
Example #7
Source File: DiskStorageCacheFactory.java    From fresco with MIT License 4 votes vote down vote up
@Override
public FileCache get(DiskCacheConfig diskCacheConfig) {
  return buildDiskStorageCache(diskCacheConfig, mDiskStorageFactory.get(diskCacheConfig));
}
 
Example #8
Source File: FileCacheFactory.java    From fresco with MIT License votes vote down vote up
FileCache get(DiskCacheConfig diskCacheConfig);