0.0.3 • Published 4 years ago
a-cachify v0.0.3
a-cachify
Easily add a cache layer to any function.
Installation
npm install a-cachify
Usages
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
API
cachify (cache, fn , keyMaker )
add a cache layer to the function.
apply (cache)
wrap (cache)
join
joinN
License
Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.