Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

conenct-redis for multi_redis

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.md
Octocat-spinner-32 Makefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 bm.js
Octocat-spinner-32 index.html
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
Octocat-spinner-32 test.js
Readme.md

Connect Redis

connect-redis is a Redis session store backed by node_redis, and is insanely fast :). Requires redis >= 1.3.10 for the SETEX command.

connect-redis >= 1.0.0 support only connect >= 1.0.0.

Installation

  $ npm install connect-redis

Options

  • client An existing redis client object you normally get from redis.createClient()
  • host Redis server hostname
  • port Redis server portno
  • db Database index to use
  • pass Password for Redis authentication
  • prefix Key prefix defaulting to "sess:"
  • ... Remaining options passed to the redis createClient() method.

Usage

Due to npm 1.x changes, we now need to pass connect to the function connect-redis exports in order to extend connect.session.Store:

var connect = require('connect')
      , RedisStore = require('connect-redis')(connect);

connect.createServer(
  connect.cookieParser(),
  // 5 minutes
  connect.session({ store: new RedisStore, secret: 'keyboard cat' })
);

This means express users may do the following, since express.session.Store points to the connect.session.Store function:

var RedisStore = require('connect-redis')(express);
Something went wrong with that request. Please try again.