Skip to content

jtblin/node-sync-redis-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sync-redis-store

Synchronous Fibers-powered Redis store for sync-cache. The store use syncho to retrieve data "synchronously" from memcached so the code needs to run in a Fiber.

Usage

npm install sync-redis-store --save
var Sync = require('syncho')
    , SyncCache = require('sync-cache')
    , RedisStore = require('sync-redis-store')
    , store = new RedisStore({ host: 'my-redis.com', maxAge: 1000*60*60, ns: 'mynamespace' })
    , cache = new SyncCache({ store: store, load: mySyncFunction })
    ;

Sync(function () {
  console.log(cache.get('some-key'));
});

function mySyncFunction () {
  return 'some value';
}

Parameters

  • options - an options object

Options

  • host - redis endpoint
  • port - redis port
  • auth - redis auth secret
  • ns - optional namespace
  • maxAge - maximum number of milliseconds to keep items, defaults 60000
  • separator - separator for namespace (default /)

Testing

npm test

License

BSD

About

A synchronous Fibers-powered redis store for SyncCache module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published