why getMainDiskStorageCache method call the getSmallDiskStorageCache
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.
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
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" .