mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
fix(core): throw URL cache key (#10497)
This commit is contained in:
3
lib/middleware/cache/index.js
vendored
3
lib/middleware/cache/index.js
vendored
@@ -56,6 +56,9 @@ module.exports = function (app) {
|
||||
app.context.cache = {
|
||||
...cacheModule,
|
||||
tryGet: async (key, getValueFunc, maxAge = config.cache.contentExpire, refresh = true) => {
|
||||
if (typeof key !== 'string') {
|
||||
throw Error('Cache key must be a string');
|
||||
}
|
||||
let v = await get(key, refresh);
|
||||
if (!v) {
|
||||
v = await getValueFunc();
|
||||
|
||||
Reference in New Issue
Block a user