Easily add a cache layer to any function.
npm install a-cachify
const { cachify, join } = require("a-cachify");
const Cache = require("cache-module");
const cache = new Cache();
let doSomething = function (arg1, arg2) {
result = heavyWork(arg1, arg2);
return result;
};
// Add a cache layer
doSomething = cachify(cache, doSomething, join);
doSomething(1, 2);
doSomething(1, 2); // return the cached result
add a cache layer to the function.
Copyright (c) 2020 dailyrandomphoto. Licensed under the MIT license.