com.facebook.common.disk.NoOpDiskTrimmableRegistry Java Examples

The following examples show how to use com.facebook.common.disk.NoOpDiskTrimmableRegistry. 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: DiskCacheConfig.java    From FanXin-based-HuanXin with GNU General Public License v2.0 6 votes vote down vote up
private DiskCacheConfig(Builder builder) {
  mVersion = builder.mVersion;
  mBaseDirectoryName = Preconditions.checkNotNull(builder.mBaseDirectoryName);
  mBaseDirectoryPath = Preconditions.checkNotNull(builder.mBaseDirectoryPath);
  mDefaultSizeLimit = builder.mMaxCacheSize;
  mLowDiskSpaceSizeLimit = builder.mMaxCacheSizeOnLowDiskSpace;
  mMinimumSizeLimit = builder.mMaxCacheSizeOnVeryLowDiskSpace;
  mCacheErrorLogger =
      builder.mCacheErrorLogger == null ?
          NoOpCacheErrorLogger.getInstance() :
          builder.mCacheErrorLogger;
  mCacheEventListener =
      builder.mCacheEventListener == null ?
          NoOpCacheEventListener.getInstance() :
          builder.mCacheEventListener;
  mDiskTrimmableRegistry =
      builder.mDiskTrimmableRegistry == null ?
          NoOpDiskTrimmableRegistry.getInstance() :
          builder.mDiskTrimmableRegistry;
}
 
Example #2
Source File: MyApplication.java    From PicKing with Apache License 2.0 5 votes vote down vote up
private DiskCacheConfig getDiskCacheConfig() {
    return DiskCacheConfig.newBuilder(this)
            .setBaseDirectoryPath(getDiskCacheDir(this))
            .setBaseDirectoryName("ImagePipelineCacheDefault")
            .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
            .setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE)
            .setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE)
            .setDiskTrimmableRegistry(NoOpDiskTrimmableRegistry.getInstance())
            .build();
}
 
Example #3
Source File: DiskCacheConfig.java    From fresco with MIT License 5 votes vote down vote up
protected DiskCacheConfig(Builder builder) {
  mContext = builder.mContext;
  Preconditions.checkState(
      builder.mBaseDirectoryPathSupplier != null || mContext != null,
      "Either a non-null context or a base directory path or supplier must be provided.");
  if (builder.mBaseDirectoryPathSupplier == null && mContext != null) {
    builder.mBaseDirectoryPathSupplier =
        new Supplier<File>() {
          @Override
          public File get() {
            return mContext.getApplicationContext().getCacheDir();
          }
        };
  }
  mVersion = builder.mVersion;
  mBaseDirectoryName = Preconditions.checkNotNull(builder.mBaseDirectoryName);
  mBaseDirectoryPathSupplier = Preconditions.checkNotNull(builder.mBaseDirectoryPathSupplier);
  mDefaultSizeLimit = builder.mMaxCacheSize;
  mLowDiskSpaceSizeLimit = builder.mMaxCacheSizeOnLowDiskSpace;
  mMinimumSizeLimit = builder.mMaxCacheSizeOnVeryLowDiskSpace;
  mEntryEvictionComparatorSupplier =
      Preconditions.checkNotNull(builder.mEntryEvictionComparatorSupplier);
  mCacheErrorLogger =
      builder.mCacheErrorLogger == null
          ? NoOpCacheErrorLogger.getInstance()
          : builder.mCacheErrorLogger;
  mCacheEventListener =
      builder.mCacheEventListener == null
          ? NoOpCacheEventListener.getInstance()
          : builder.mCacheEventListener;
  mDiskTrimmableRegistry =
      builder.mDiskTrimmableRegistry == null
          ? NoOpDiskTrimmableRegistry.getInstance()
          : builder.mDiskTrimmableRegistry;
  mIndexPopulateAtStartupEnabled = builder.mIndexPopulateAtStartupEnabled;
}