feat: 支持订阅/文件级别的自定义缓存时长

This commit is contained in:
xream committed 2026-04-10 17:40:10 +08:00
1 parent 78c7b62b84
commit 8c98f39824
3 files changed
+23 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.86",
"version": "2.21.87",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
+15 -2
View File
@@ -304,7 +304,13 @@ export default async function download(
if (headers) {
const flowInfo = getFlowField(headers);
if (flowInfo) {
headersResourceCache.set(id, flowInfo);
headersResourceCache.set(
id,
flowInfo,
$arguments?.headersCacheTtl
? $arguments?.headersCacheTtl * 1000
: undefined,
);
}
}
if (body.replace(/\s/g, '').length === 0)
@@ -345,7 +351,14 @@ export default async function download(
}
}
if (shouldCache) {
resourceCache.set(id, body);
console.log($arguments);
resourceCache.set(
id,
body,
$arguments?.cacheTtl
? $arguments?.cacheTtl * 1000
: undefined,
);
if (customCacheKey) {
$.info(
`URL ${url}\n写入自定义缓存 ${$arguments?.cacheKey}`,
+7 -1
View File
@@ -226,7 +226,13 @@ export async function getFlowHeaders(
flowInfo = flowInfo.trim();
}
if (flowInfo) {
headersResourceCache.set(id, flowInfo);
headersResourceCache.set(
id,
flowInfo,
$arguments?.headersCacheTtl
? $arguments?.headersCacheTtl * 1000
: undefined,
);
}
}