Search in sources :

Example 6 with DiskCache

use of com.bumptech.glide.load.engine.cache.DiskCache in project glide by bumptech.

the class ExternallyClearedDiskCacheTest method clearDiskCache_afterOpeningDiskCache_andDeleteDirectoryOutsideGlide_doesNotThrow.

@Test
public void clearDiskCache_afterOpeningDiskCache_andDeleteDirectoryOutsideGlide_doesNotThrow() {
    DiskCache cache = DiskLruCacheWrapper.create(cacheDir, 1024 * 1024);
    cache.get(mock(Key.class));
    deleteRecursively(cacheDir);
    cache.clear();
}
Also used : DiskCache(com.bumptech.glide.load.engine.cache.DiskCache) Key(com.bumptech.glide.load.Key) Test(org.junit.Test)

Example 7 with DiskCache

use of com.bumptech.glide.load.engine.cache.DiskCache in project fresco by facebook.

the class SampleGlideModule method applyOptions.

@Override
public void applyOptions(final Context context, GlideBuilder builder) {
    builder.setDiskCache(new DiskCache.Factory() {

        @Override
        public DiskCache build() {
            return DiskLruCacheWrapper.get(Glide.getPhotoCacheDir(context), ConfigConstants.MAX_DISK_CACHE_SIZE);
        }
    });
    builder.setMemoryCache(new LruResourceCache(ConfigConstants.MAX_MEMORY_CACHE_SIZE));
}
Also used : LruResourceCache(com.bumptech.glide.load.engine.cache.LruResourceCache) DiskCache(com.bumptech.glide.load.engine.cache.DiskCache)

Aggregations

DiskCache (com.bumptech.glide.load.engine.cache.DiskCache)7 Key (com.bumptech.glide.load.Key)4 Test (org.junit.Test)4 LruResourceCache (com.bumptech.glide.load.engine.cache.LruResourceCache)3 Drawable (android.graphics.drawable.Drawable)2 LruBitmapPool (com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool)2 Factory (com.bumptech.glide.load.engine.cache.DiskCache.Factory)2 MemorySizeCalculator (com.bumptech.glide.load.engine.cache.MemorySizeCalculator)2 File (java.io.File)2 AppComponent (com.tool.common.di.component.AppComponent)1 BaseImageLoader (com.tool.common.widget.imageloader.BaseImageLoader)1