description
$ npm install node-redis-rotatingkey-session --no-optional
Setup your redis server.
$ redis-server start
$ redis-cli
redis> LPUSH keygrip "110E8400-E29B-11D4-A716-446655440000"
Then create a simple express app.
var express = require('express');
var rrkSession = require('redis-rotatingkey-session');
var app = express();
app.use(rrksess({
// TODO - options
}));
app.listen(3000);
name
- The cookie name. Defaults torrksess
.keys
- Name of Redis key which holds the list of rotating keys. Defaults tokeygrip
.port
- Port on which redis resides. Defaults to6379
.domain
- Domain on which redis resides. Defaults tolocalhost
.pass
- Redis password. Defaults to none (null
).expiry
- How long before expiring session. Defaults to604800
or 1 week.expireExtend
- Extend session forexpiry
length if user is active in the lastx
amount of time. Defaults to3600
or 1 hour.
To install optional hiredis
for speedier transactions (not really that
helpful in this case) you can run npm install redis-rotatingkey-session
.
However, this may require that you point npm to >=python2.6 for compilation. To do this, run npm config set python /path/to/python2
.