Manages multiple redis hosts for sessions

Manages multiple redis host fallbacks for sessions.

Once the connection to the current host fails, it choses another connected host, preventing the app from crashing.

If no redis hosts are connected it degrades to the builtin MemoryStore.

Place the middleware just after the cookieParser and before the session-middleware of Connect or Express

var connect = require('connect');
var http = require('http');
var RedisStore = require('connect-redis')(connect);
var options = {
  hosts: [
    new RedisStore({
      host: '',
      port: 63793,
      maxAge: null
    new RedisStore({
      host: '',
      port: 63793,
      maxAge: null
  session_secret: 'foo',
  cookie: {
    maxAge: null
var app = connect();
var multipleRedisSessions = require('connect-multi-redis')(app, connect.session, options);
  .use(connect.session({ store: options.hosts[0], secret: options.session_secret }))
  .use(function(reqres) {
    res.end('Hello World');
var server = http.createServer(app).listen(3000);