Reduce image cache to 100mb (#683)

* Reduce image cache to 100mb
This commit is contained in:
self-similarity 2023-10-11 23:06:22 +00:00 committed by GitHub
parent bb6a17e23c
commit 1ccd3d732d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,7 @@ import com.bumptech.glide.Registry
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.module.AppGlideModule
import com.bumptech.glide.request.RequestOptions
@ -27,6 +28,10 @@ class GlideModule : AppGlideModule() {
RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.signature(ObjectKey(System.currentTimeMillis().toShort()))
}.setDiskCache {
// Possible to make this a setting in the future.
val memoryCacheSizeBytes: Long = 1024 * 1024 * 100; // 100mb
InternalCacheDiskCacheFactory(context, memoryCacheSizeBytes).build()
}
}