Files
express-twtkpr/dist/src/middlewares/postHandler/memoryCache.js
2026-03-17 22:49:38 -04:00

25 lines
540 B
JavaScript

import Debug from 'debug';
const debug = Debug('twtkpr:memoryCache');
/**
*
* @param req
* @param res
* @param next
* @param cache
* @param reloadCache
* @returns
*/
export default async function memoryCache(req, res, next, cache, reloadCache) {
if (cache.keys().length && !['DELETE', 'POST', 'PUT'].includes(req.method)) {
next();
return;
}
reloadCache()
.then(() => {
next();
})
.catch((err) => {
console.error(err);
});
}
//# sourceMappingURL=memoryCache.js.map