connect-redis-realtime

0.0.2 • Public • Published

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-realtime

Options

  • max An integer containing the maximum number of sessions cacheable - set to at least your maximum-expected concurrent users. Defaults to Infinity.
  • client An existing redis client object you normally get from redis.createClient()
  • host Redis server hostname
  • port Redis server portno
  • ttl Session TTL in seconds
  • db Database index to use
  • pass Password for Redis authentication
  • prefix Key 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.

Readme

Keywords

none

Package Sidebar

Install

npm i connect-redis-realtime

Weekly Downloads

2

Version

0.0.2

License

none

Last publish

Collaborators

  • korbin