Reduce cache time.

This commit is contained in:
NobyDa 2024-04-13 10:51:05 +08:00
parent 6137b5add4
commit 16a20f1b85
No known key found for this signature in database
GPG Key ID: E6B0AC788D373C5B
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ TestFlight账户管理脚本
脚本作者: @NobyDa
脚本兼容: Surge4QuantumultXLoon(2.1.20 413+)
更新时间: 2024/04/07
更新时间: 2024/04/13
主要功能
1. 自动存储多个TestFlight账户并自动合并APP列表避免切换账户
@ -198,7 +198,7 @@ function QueryRequest(o) {
if ($.EnableCache && r.body && r.body.startsWith('{')) {
$.log(`Account "${o}" URL "${option.url}" Write data to cache`);
cache[option.url] = { response: r, lastUsed: Date.now() };
Object.keys(cache).forEach((i) => (Date.now() - (cache[i].lastUsed || 0) > 864e5 * 7) && delete cache[i]);
Object.keys(cache).forEach((i) => (Date.now() - (cache[i].lastUsed || 0) > 864e5 * 3) && delete cache[i]);
$.write(JSON.stringify(cache), '#TESTFLIGHT-ACCOUNT-CACHE');
}
return { ...r, account: o }