0.0.2 • Published 13 years ago
connect-redis-realtime v0.0.2
Connect Redis: Realtime
connect-redis-realtime is an extension of the connect-redis session store.
The difference is, this library is backed by an internal LRU cache to prevent excess network chatter on mildly-stable data. This cache is dynamically expired across nodes via redis built-in pubsub - perfect for realtime apps.
connect-redis is a Redis session store backed by node_redis, and is insanely fast :). Requires redis >= 2.0.0 for the SETEX command.
Installation
$ npm install connect-redis-realtimeOptions
maxAn integer containing the maximum number of sessions cacheable - set to at least your maximum-expected concurrent users. Defaults to Infinity.clientAn existing redis client object you normally get fromredis.createClient()hostRedis server hostnameportRedis server portnottlSession TTL in secondsdbDatabase index to usepassPassword for Redis authenticationprefixKey prefix defaulting to "sessions."- ... Remaining options passed to the redis
createClient()method.
Usage
Pass connect to the function connect-redis-realtime exports in order to extend connect.session.Store:
var connect = require('connect')
, RedisStoreRealtime = require('connect-redis-realtime')(connect);
connect()
.use(connect.session({ store: new RedisStoreRealtime(options), secret: 'keyboard cat' })) Express users may do the following, since express.session.Store points to the connect.session.Store function:
var RedisStoreRealtime = require('connect-redis-realtime')(express);License
MIT
Thanks
Thanks to TJ Holowaychuk for connect-redis
To-Do
Full test coverage.