distribucache-memory-store
v5.0.1
Published
RAM-backed Distribucache Store
Downloads
14
Readme
Distribucache Memory Store
A memory (RAM) datastore for the Distribucache auto-repopulating cache.
Usage
Here's what a simple service using Distribucache with memory may look like:
var distribucache = require('distribucache'),
memoryStore = require('distribucache-memory-store'),
cacheClient = distribucache.createClient(memoryStore()),
model = require('../model'), // for example
cache,
Service;
cache = cacheClient.create('my:values', {
staleIn: '10 sec',
populateIn: '5 sec',
pausePopulateIn: '1 min',
populate: function (key, cb) {
model.get(key, cb);
}
});
Service.get = function (key, cb) {
cache.get(key, cb);
};
API
memoryStore()