Skip to content
/ memoiz Public

Node.js / javascript module to cache method's returned values

License

Notifications You must be signed in to change notification settings

findhit/memoiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memoiz

Test Status Dependency Status

Node.js / javascript module to cache method's return value

Installation

npm install --save memoiz

Usage

var Memoiz = require( 'memoiz' );

var sum = Memoiz.method(function ( a, b ) {
    return a + b;
});

// First run will trigger a cache set
sum( 1, 2 ); // 3

// Second run will trigger a cache get
// without running provided method
sum( 1, 2 ); // 3

Future features

In the future we should add:

  • Abillity to detect uniqueness on arguments to cache specific responses (at the time it is caching only one result);
  • Different kinds of stores;

About

Node.js / javascript module to cache method's returned values

Resources

License

Stars

Watchers

Forks

Packages

No packages published