Actually disable caching if cache size is set to zero.

This commit is contained in:
Antoine POPINEAU 2020-06-26 18:50:17 +02:00
parent 441ca3249c
commit 212b44a22f
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
1 changed files with 3 additions and 1 deletions

View File

@ -36,9 +36,11 @@ class Otter : Application() {
val exoCache: SimpleCache by lazy {
PowerPreference.getDefaultFile().getInt("media_cache_size", 1).toLong().let {
val cacheSize = if (it == 0L) 0 else it * 1024 * 1024 * 1024
SimpleCache(
cacheDir.resolve("media"),
LeastRecentlyUsedCacheEvictor(it * 1024 * 1024 * 1024),
LeastRecentlyUsedCacheEvictor(cacheSize),
exoDatabase
)
}