rgcache
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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());
})();

Readme

Keywords

Package Sidebar

Install

npm i rgcache

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

20.6 kB

Total Files

8

Last publish

Collaborators

  • redguys