a-cachify

0.0.3 • Public • Published

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 ] [ , thisArg ])

add a cache layer to the function.

apply (cache)

wrap (cache)

join

joinN

License

Copyright (c) 2019 dailyrandomphoto. Licensed under the MIT license.

Readme

Keywords

Package Sidebar

Install

npm i a-cachify

Weekly Downloads

6

Version

0.0.3

License

MIT

Unpacked Size

5.8 kB

Total Files

4

Last publish

Collaborators

  • dailyrandomphoto