|
|
|
@ -38,7 +38,6 @@
|
|
|
|
|
module.init = function (callback) {
|
|
|
|
|
try {
|
|
|
|
|
redis = require('redis');
|
|
|
|
|
connectRedis = require('connect-redis')(session);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
winston.error('Unable to initialize Redis! Is Redis installed? Error :' + err.message);
|
|
|
|
|
process.exit();
|
|
|
|
@ -48,11 +47,6 @@
|
|
|
|
|
|
|
|
|
|
module.client = redisClient;
|
|
|
|
|
|
|
|
|
|
module.sessionStore = new connectRedis({
|
|
|
|
|
client: redisClient,
|
|
|
|
|
ttl: 60 * 60 * 24 * 14
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
require('./redis/main')(redisClient, module);
|
|
|
|
|
require('./redis/hash')(redisClient, module);
|
|
|
|
|
require('./redis/sets')(redisClient, module);
|
|
|
|
@ -64,6 +58,22 @@
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.initSessionStore = function (callback) {
|
|
|
|
|
var meta = require('../meta');
|
|
|
|
|
connectRedis = require('connect-redis')(session);
|
|
|
|
|
|
|
|
|
|
var ttlDays = 1000 * 60 * 60 * 24 * (parseInt(meta.config.loginDays, 10) || 14);
|
|
|
|
|
|
|
|
|
|
module.sessionStore = new connectRedis({
|
|
|
|
|
client: redisClient,
|
|
|
|
|
ttl: ttlDays
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.connect = function (options) {
|
|
|
|
|
var redis_socket_or_host = nconf.get('redis:host');
|
|
|
|
|
var cxn;
|
|
|
|
|