From 946c08e21f1c3081ed06d8cb2202b9d2a56c717b Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 18 Nov 2020 20:00:48 +0800 Subject: [PATCH] =?UTF-8?q?js=E6=B7=BB=E5=8A=A0cache=E5=8F=98=E9=87=8F,?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=94=A8=E6=9D=A5=E5=AD=98=E5=82=A8token?= =?UTF-8?q?=E4=B9=8B=E7=B1=BB=E7=9A=84=E5=8F=98=E9=87=8F,=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=AE=BE=E7=BD=AE=E6=97=B6=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 4 +++- app/src/main/java/io/legado/app/help/CacheManager.kt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 8df9d933c..da8aa319c 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -6,7 +6,9 @@ **2020/11/18** * 优化导航栏 * js添加java.log(msg: String)用于调试时输出消息 -* js添加cookie对象,可用方法见io.legado.app.help.http.api.CookieManager +* js添加cookie变量,方法见io.legado.app.help.http.api.CookieManager +* js添加cache变量,可以用来存储token之类的临时值,可以设置保存时间,方法见io.legado.app.help.CacheManager +* 需要token的网站可以用js来写了,比如阿里tts **2020/11/16** * 修复导出添加替换净化引起的bug 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 558b71f0c..8a88811f6 100644 --- a/app/src/main/java/io/legado/app/help/CacheManager.kt +++ b/app/src/main/java/io/legado/app/help/CacheManager.kt @@ -5,6 +5,7 @@ import io.legado.app.data.entities.Cache object CacheManager { + @JvmOverloads fun put(key: String, value: Any, saveTime: Int = 0) { val deadline = if (saveTime == 0) 0 else System.currentTimeMillis() + saveTime * 1000 val cache = Cache(key, value.toString(), deadline)