memoize-async

Async Function Memoizer

npm install memoize-async
1 downloads in the last day
10 downloads in the last week
20 downloads in the last month

memoize-async Build Status

Async function memoizer.

Install

$ npm install memoize-async

Usage

memoize  = require('memoize-async')
readFile = require('fs').readFile
memoized = memoize(readFile)

memoized('docs/readme', console.log)
// doing some work
// => read me first!

memoized('docs/readme', console.log)
// => read me first!

Storage

It stores the values returned in an object by default. You can pass read & write methods to choose your own:

memoized = memoize(fn, { read: read, write: write, hash: ifexists })

function read (key, callback) {
}

function write (key, value, callback) {
}
npm loves you