GitHub - man1989/simple-cache

Caches data locally This is a very naive solution, just a showcase how things could be implemented

const Cache = require("simple-cache");

let localCache = new Cache();

localCache.set(key, value, [TTL in sec]); //set value

localCache.set(key, value, 3); //sets the value and will get expires after 3 seconds

localCache.get(key); //get the value

localCache.del(key); //delete the value, returns deleted value

localCache.on("expired", (key, value)=>{
    //when key expires, this event will get called
});