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

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i rgcache

      Weekly Downloads

      2

      Version

      1.0.10

      License

      MIT

      Unpacked Size

      8.32 kB

      Total Files

      6

      Last publish

      Collaborators

      • redguys