Package Exports
- express-bad-cache
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-bad-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
express-bad-cache
Note: Real simple cache to be used on non production sites. Important! all the merit go to this project: https://github.com/jpresagios/express-api-cache
Cache a route Ready to use sample
var express = require("express");
var app = express();
var cacheService = require("express-bad-cache");
var cache = cacheService.cache;
app.get('/getPlayerList', cache('1 minutes', 'application/json'), (req, res) => {
// Do some work to retrieve movies and request before 10 minutes will get movies from cache
res.json([
{
"ServerKey": "TheIsland",
"ServerTag": "IS",
"PlayerName": "LeMorteine",
"CharacterName": "John Wick",
"TribeName": "Tribe of Lucaz"
},
{
"ServerKey": "TheIsland",
"ServerTag": "IS",
"PlayerName": "Luiss730",
"CharacterName": "xavi",
"TribeName": "Tribe of Lucaz"
}]);
});
app.listen(3000, function () {
console.log(`Example app listening on 3000!`);
});
API
valid units
- ms, second, minute, hour, day, week, month.duration format
- [time][unit] as5 minutes