diff --git a/lib/middleware/cache.js b/lib/middleware/cache.js index a6d469dea..5feddf2f4 100644 --- a/lib/middleware/cache.js +++ b/lib/middleware/cache.js @@ -43,10 +43,7 @@ module.exports = function(app, options = {}) { return value; } }, - set: async function(key, value, maxAge = 24 * 60 * 60) { - if (await this.get(key)) { - logger.warn(`repeated key: ${key}, ${value}`); - } + set: async (key, value, maxAge = 24 * 60 * 60) => { if (!value || value === 'undefined') { value = ''; } @@ -144,7 +141,6 @@ module.exports = function(app, options = {}) { let type; let ok = false; - logger.warn(`getCache in ${key}`); if (value) { ctx.response.status = 200; type = (await globalCache.get(tkey)) || 'text/html'; @@ -244,7 +240,6 @@ module.exports = function(app, options = {}) { try { ok = await getCache(ctx, key, tkey); } catch (e) { - logger.warn(`getCache catch ${e instanceof Error ? e.stack : e}`); ok = false; } if (ok) { diff --git a/lib/routes/readhub/category.js b/lib/routes/readhub/category.js index 0dcf8d468..8cd2ba43a 100644 --- a/lib/routes/readhub/category.js +++ b/lib/routes/readhub/category.js @@ -78,6 +78,8 @@ module.exports = async (ctx) => { guid: id, link, }; + + await ctx.cache.set(link, JSON.stringify(item), 24 * 60 * 60); } else { const description = news.summaryAuto || news.summary || news.title; item = { @@ -88,8 +90,6 @@ module.exports = async (ctx) => { link: news.url || news.mobileUrl, }; } - - await ctx.cache.set(link, JSON.stringify(item), 24 * 60 * 60); return Promise.resolve(item); }) );