diff --git a/backend/package.json b/backend/package.json index dd6c7992..cda40119 100644 --- a/backend/package.json +++ b/backend/package.json @@ -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": { diff --git a/backend/src/utils/download.js b/backend/src/utils/download.js index edce833a..d7d475d5 100644 --- a/backend/src/utils/download.js +++ b/backend/src/utils/download.js @@ -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}`, diff --git a/backend/src/utils/flow.js b/backend/src/utils/flow.js index aaca8130..3b605407 100644 --- a/backend/src/utils/flow.js +++ b/backend/src/utils/flow.js @@ -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, + ); } }