diff --git a/app/src/main/java/io/legado/app/help/CacheManager.kt b/app/src/main/java/io/legado/app/help/CacheManager.kt index cc1ce71f1..3b5d89bdb 100644 --- a/app/src/main/java/io/legado/app/help/CacheManager.kt +++ b/app/src/main/java/io/legado/app/help/CacheManager.kt @@ -29,10 +29,7 @@ object CacheManager { } fun putString2File(key: String, value: String, saveTime: Int = 0) { - if (saveTime == 0) { - //不设置过期时间 - ACache.get(appCtx).put(key, value) - } else ACache.get(appCtx).put(key, value, saveTime) + ACache.get(appCtx).put(key, value, saveTime) } fun get(key: String): String? { diff --git a/app/src/main/java/io/legado/app/utils/ACache.kt b/app/src/main/java/io/legado/app/utils/ACache.kt index 11b448aa6..b900095c3 100644 --- a/app/src/main/java/io/legado/app/utils/ACache.kt +++ b/app/src/main/java/io/legado/app/utils/ACache.kt @@ -109,7 +109,7 @@ class ACache private constructor(cacheDir: File, max_size: Long, max_count: Int) * @param saveTime 保存的时间,单位:秒 */ fun put(key: String, value: String, saveTime: Int) { - put(key, Utils.newStringWithDateInfo(saveTime, value)) + if (saveTime == 0) put(key, value) else put(key, Utils.newStringWithDateInfo(saveTime, value)) } /** @@ -245,7 +245,7 @@ class ACache private constructor(cacheDir: File, max_size: Long, max_count: Int) * @param saveTime 保存的时间,单位:秒 */ fun put(key: String, value: ByteArray, saveTime: Int) { - put(key, Utils.newByteArrayWithDateInfo(saveTime, value)) + if (saveTime == 0) put(key, value) else put(key, Utils.newByteArrayWithDateInfo(saveTime, value)) } /**