redis-generational-cache

1.0.2 • Public • Published

redis-generational-cache

Build Status

NPM NPM

Installation

npm install redis-generational-cache

Usage

var redis = require("redis");
var GenCache = require("redis-generational-cache");
var cache = new GenCache({redis: redis.createClient()});
 
cache.set("foo", 42, "bar", function(err, value) {
  cache.get("foo", "bar", function(err, value) {
    console.log(value); // 42
    cache.invalidateGroups("bar", function() {
      cache.get("foo", "bar", function(err, value) {
        console.log(value); // null
      });
    });
  });
});

This uses redis' sets to store and invalidate groups so operations are not O(1), but they are all atomic.

Package Sidebar

Install

npm i redis-generational-cache

Weekly Downloads

0

Version

1.0.2

License

ISC

Last publish

Collaborators

  • jlburkhead