mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-03 09:45:54 +00:00
feat: 支持订阅/文件级别的自定义缓存时长
This commit is contained in:
3 files changed
+23
-4
No files matched your search
@@ -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": {
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user