alpha release
update v0.8.0
This commit is contained in:
25
dist/src/middlewares/postHandler/memoryCache.js
vendored
Normal file
25
dist/src/middlewares/postHandler/memoryCache.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
Reference in New Issue
Block a user