rgcache
v1.1.4
Published
Little caching module.
Downloads
13
Readme
rgcache
Little caching module.
Installing
npm install rgcache
yarn add rgcache
Example
let Cache = require('rgcache').Cache;
let aCache = new Cache({
ttl: 600, loader: async (key) => {
console.log("loader call");
return key.toLowerCase();
}
});
(async () => {
console.log(await aCache.get("BAN"));
await aCache.get("BAN");
aCache.delete("BAN");
await aCache.get("BAN");
aCache.set("LOL", "lols");
console.log(await aCache.get("LOL"))
aCache.clear();
console.log(await aCache.get("LOL"))
console.log(aCache.stats());
})();