fresco icon indicating copy to clipboard operation
fresco copied to clipboard

why getMainDiskStorageCache method call the getSmallDiskStorageCache

Open binqiangsun opened this issue 11 years ago • 2 comments

I wrote the disk cache of fresco as followed:

DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder() .setMaxCacheSize(DISK_CACHE_SIZE_HIGH) .setMaxCacheSizeOnLowDiskSpace(DISK_CACHE_SIZE_LOW) .setMaxCacheSizeOnVeryLowDiskSpace(DISK_CACHE_SIZE_VERY_LOW) .setBaseDirectoryName(diskCacheUniqueName) .setBaseDirectoryPath(getDiskCacheDir(context, diskCacheUniqueName)) .setVersion(getAppVersion(context)) .build(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context) .setMainDiskCacheConfig(diskCacheConfig)

Then I want to get the size of disk cache, I call the method of "getMainDiskStorageCache().getsize()" But it returned -1.

I debuged the code and found that getMainDiskStorageCache() not called but getSmallDiskStorageCache() called.

I am confused.

binqiangsun avatar May 08 '15 08:05 binqiangsun

Most apps only use one cache. So by default, the small disk cache is the same as the main disk cache.

You have to explicitly call setSmallDiskCacheConfig with a different config, as explained in http://frescolib.org/docs/caching.html#using-one-disk-cache-or-two

tyronen avatar May 08 '15 15:05 tyronen

Fresco.initialize(getApplicationContext()); . . .

long i = Fresco.getImagePipelineFactory().getMainDiskStorageCache().getSize(); Log.d(TAG,"cache size:" + i);

I use the default config, but it still print "-1" .

snowjade avatar Jan 05 '16 02:01 snowjade