From ea22b11610b156a059b0d04ae0a8051a351acee5 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Thu, 8 Jan 2026 08:30:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=97=B6=E9=97=B4=E6=94=AF=E6=8C=81=E5=B9=B6?= =?UTF-8?q?=E5=BB=B6=E9=95=BF=E9=BB=98=E8=AE=A4=E7=BC=93=E5=AD=98=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当请求参数包含random时,将缓存时间设置为5秒,否则默认延长至7天 --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 066beb1..817f820 100644 --- a/index.js +++ b/index.js @@ -560,11 +560,12 @@ fastify.get('/*', async (request, reply) => { // 获取nocache 参数 const nocache = request.query.nocache ? true : false; + const random = request.query.random ? true : false; try { const key = getTokenKey(token); const metaPath = getMetaPath(key); - const ONE_DAY_MS = 24 * 60 * 60 * 1000; + const ONE_DAY_MS = random ? 5 * 1000 : 86400 * 7 * 1000; let apiData = null; if (fs.existsSync(metaPath) && !nocache) { try {