connect-redis is a Redis session store backed by node_redis, and is insanely fast :). Requires redis >= 2.0.0
for the SETEX command.
$ npm install connect-redis
client
An existing redis client object you normally get fromredis.createClient()
host
Redis server hostnameport
Redis server portnottl
Redis session TTL in secondsdb
Database index to usepass
Password for Redis authenticationprefix
Key prefix defaulting to "sess:"url
String that contains connection information in a single url (redis://user:pass@host:port/db)- ... Remaining options passed to the redis
createClient()
method.
Due to express 4.x.x changes, we now need to pass express-session to the function connect-redis
exports in order to extend express-session.Store
:
var session = require('express-session')
, RedisStore = require('connect-redis')(session);
app.use(session({ store: new RedisStore(options), secret: 'keyboard cat' }))
MIT