This commit is contained in:
gedoor
2022-01-07 23:12:07 +08:00
parent ddb4dcab1c
commit d46c11705f
@@ -28,10 +28,6 @@ object CacheManager {
} }
} }
fun putString2File(key: String, value: String, saveTime: Int = 0) {
ACache.get(appCtx).put(key, value, saveTime)
}
fun get(key: String): String? { fun get(key: String): String? {
return appDb.cacheDao.get(key, System.currentTimeMillis()) return appDb.cacheDao.get(key, System.currentTimeMillis())
} }
@@ -56,10 +52,6 @@ object CacheManager {
return ACache.get(appCtx).getAsBinary(key) return ACache.get(appCtx).getAsBinary(key)
} }
fun getString(key: String): String? {
return ACache.get(appCtx).getAsString(key)
}
fun getQueryTTF(key: String): QueryTTF? { fun getQueryTTF(key: String): QueryTTF? {
val cache = queryTTFMap[key] ?: return null val cache = queryTTFMap[key] ?: return null
if (cache.first == 0L || cache.first > System.currentTimeMillis()) { if (cache.first == 0L || cache.first > System.currentTimeMillis()) {
@@ -68,6 +60,14 @@ object CacheManager {
return null return null
} }
fun putFile(key: String, value: String, saveTime: Int = 0) {
ACache.get(appCtx).put(key, value, saveTime)
}
fun getFile(key: String): String? {
return ACache.get(appCtx).getAsString(key)
}
fun delete(key: String) { fun delete(key: String) {
appDb.cacheDao.delete(key) appDb.cacheDao.delete(key)
ACache.get(appCtx).remove(key) ACache.get(appCtx).remove(key)