0.0.3 • Published 4 years ago

a-cachify v0.0.3

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

a-cachify

NPM Version LICENSE Build Status dependencies Status devDependencies Status

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.

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago