Skip to content

Commit 5ee7074

Browse files
committed
checking keys length before calling cache.del(keys)
1 parent 823e18b commit 5ee7074

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const middleware = (opts) => async (req, res, next) => {
8989
return acc
9090
}, [])
9191
// delete keys on all cache tiers
92-
patterns.forEach(pattern => opts.stores.forEach(store => getKeys(store, pattern).then(keys => mcache.del(keys))))
92+
patterns.forEach(pattern => opts.stores.forEach(store => getKeys(store, pattern).then(keys => keys.length > 0 ? mcache.del(keys) : null)))
9393
} else if (payload.headers[X_CACHE_TIMEOUT] || payload.headers[CACHE_CONTROL]) {
9494
// extract cache ttl
9595
let ttl = 0

0 commit comments

Comments
 (0)