express session + redis store
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
app.use(cookieParser());
app.use(session({
store: new RedisStore({
client: RedisClient,
ttl: 90000, //session有效期 单位 秒
prefix: game_config.redis_prefix + 'sess:',
logErrors: true
}),
secret: game_dev.server_name,
cookie: {maxAge:90000000}, //session有效期 单位 ms
resave: false,
saveUninitialized: true
}));
req.session.uid = userInfo._id;