|
|
@ -28,6 +28,13 @@ 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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun get(key: String): String? { |
|
|
|
fun get(key: String): String? { |
|
|
|
return appDb.cacheDao.get(key, System.currentTimeMillis()) |
|
|
|
return appDb.cacheDao.get(key, System.currentTimeMillis()) |
|
|
|
} |
|
|
|
} |
|
|
@ -52,6 +59,10 @@ 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()) { |
|
|
|