Blog in npm

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...

Latest Posts