mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 21:41:50 +01:00
Fallback chapter cache to internal storage
This commit is contained in:
parent
aefe7b176a
commit
6c242084ca
@ -44,9 +44,13 @@ class ChapterCache(private val context: Context) {
|
|||||||
/** Google Json class used for parsing JSON files. */
|
/** Google Json class used for parsing JSON files. */
|
||||||
private val gson: Gson by injectLazy()
|
private val gson: Gson by injectLazy()
|
||||||
|
|
||||||
|
/** Parent directory of the cache. Ensure not null and not root directory or fallback
|
||||||
|
* to internal cache directory. **/
|
||||||
|
private val basePath = context.externalCacheDir?.takeIf { it.absolutePath.length > 1 }
|
||||||
|
?: context.cacheDir
|
||||||
|
|
||||||
/** Cache class used for cache management. */
|
/** Cache class used for cache management. */
|
||||||
private val diskCache = DiskLruCache.open(
|
private val diskCache = DiskLruCache.open(File(basePath, PARAMETER_CACHE_DIRECTORY),
|
||||||
File(context.externalCacheDir, PARAMETER_CACHE_DIRECTORY),
|
|
||||||
PARAMETER_APP_VERSION,
|
PARAMETER_APP_VERSION,
|
||||||
PARAMETER_VALUE_COUNT,
|
PARAMETER_VALUE_COUNT,
|
||||||
PARAMETER_CACHE_SIZE)
|
PARAMETER_CACHE_SIZE)
|
||||||
|
Loading…
Reference in New Issue
Block a user