From ade7e36c79ebdf19ba507775925e32eb55c319ec Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 5 May 2022 22:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/CacheManager.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 e9e597648..625e6b995 100644 --- a/app/src/main/java/io/legado/app/help/CacheManager.kt +++ b/app/src/main/java/io/legado/app/help/CacheManager.kt @@ -11,11 +11,7 @@ import splitties.init.appCtx object CacheManager { private val queryTTFMap = hashMapOf>() - private val memoryLruCache = object : LruCache(100) { - override fun sizeOf(key: String, value: Cache): Int { - return 1 - } - } + private val memoryLruCache = object : LruCache(100) {} /** * saveTime 单位为秒 @@ -88,6 +84,8 @@ object CacheManager { val cache = queryTTFMap[key] ?: return null if (cache.first == 0L || cache.first > System.currentTimeMillis()) { return cache.second + } else { + queryTTFMap.remove(key) } return null }