First, it includes a wrap function that lets you wrap any function in cache.
(Note, this was inspired by node-caching.)
This is probably the feature you're looking for. As an example, where you might have to do this:

functiongetCachedUser(id, cb){

memoryCache.get(id,function(err, result){

if(err){return cb(err);}

if(result){

return cb(null, result);

}

getUser(id,function(err, result){

if(err){return cb(err);}

memoryCache.set(id, result);

cb(null, result);

});

});

}

... you can instead use the wrap function:

functiongetCachedUser(id, cb){

memoryCache.wrap(id,function(cacheCallback){

getUser(id, cacheCallback);

}, ttl, cb);

}

Second, node-cache-manager features a built-in memory cache (using node-lru-cache),
with the standard functions you'd expect in most caches:

set(key, val, ttl, cb)
get(key, cb)
del(key, cb)

Third, node-cache-manager lets you set up a tiered cache strategy. This may be of
limited use in most cases, but imagine a scenario where you expect tons of
traffic, and don't want to hit your primary cache (like Redis) for every request.
You decide to store the most commonly-requested data in an in-memory cache,
perhaps with a very short timeout and/or a small data size limit. But you
still want to store the data in Redis for backup, and for the requests that
aren't as common as the ones you want to store in memory. This is something
node-cache-manager handles easily and transparently.

You can use your own custom store by creating one with the same API as the
build-in memory stores (such as a redis or memcached store). To use your own store, you can either pass
in an instance of it, or pass in the path to the module.