Quick way to cache and retrieve data from cache memory
npm install static-memoryjs
const cache = require('static-memory');
cache('test', "hello world"); // result : "hello world"
console.log(cache('test')) // result : "hello world"
// other way
for(var i=0, i<3; i++){
cache(()=>{
console.log("init");
return "hello world";
});
}
/* result :
"init"
"hello world"
"hello world"
"hello world"
*/
``