distribucache-memory-store

5.0.1 • Public • Published

Distribucache Memory Store Build Status NPM version

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()

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i distribucache-memory-store

Weekly Downloads

2

Version

5.0.1

License

none

Last publish

Collaborators

  • ddrinf
  • nemtsov