Caching is always hard to integrate with applications, that's why I decided to create a simple module that worked perfectly for my program flow. Call-cache gives you a simple interface and sits between your callbacks to provide all the data you need for the next computation steps.

With a key and a function generator it will synchronously or asynchronously save in memory anything given. Follow the links on GitHub or npm to learn more about it's usage.

Related Posts

5 Apr 2017, 21:11
by repraze

I've been working hard in my spare time to bring you an update on our little friendly call-cache module.


// using the cache with Promises

cache.get('baz',
    function(callback){     // generating the cache
        console.log('Fetching Baz');
        callback('Baz');    // promise will get the first parameter
    }
).then(function(result){          // promise style, always called
    console.log('Retrieved '+result);
});

A whole new syntax is now possible with call-cache and it's future compatible! Let's avoid callback hell from now on...

Links

Repo

Stats

Collaborators