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.
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';
}
options
- an options object
host
- redis endpointport
- redis portauth
- redis auth secretns
- optional namespacemaxAge
- maximum number of milliseconds to keep items, defaults 60000separator
- separator for namespace (default/
)
npm test
BSD