connect-redis
Advanced tools
Comparing version 3.0.0 to 3.0.1
3.0.1 / 2015-10-15 | ||
================== | ||
* Remove attempts option added in 3.0 to enable reconnect again [fintura] | ||
3.0.0 / 2015-10-03 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -9,4 +9,3 @@ /*! | ||
var redis = require('redis'); | ||
var default_port = 6379; | ||
var default_host = '127.0.0.1'; | ||
var util = require("util"); | ||
var noop = function(){}; | ||
@@ -58,3 +57,2 @@ | ||
options = options || {}; | ||
options.max_attempts = 2; | ||
Store.call(this, options); | ||
@@ -67,6 +65,4 @@ this.prefix = options.prefix == null | ||
/* istanbul ignore next */ | ||
if (options.url) { | ||
options.port = options.url; | ||
options.host = options; | ||
options.socket = options.url; | ||
} | ||
@@ -81,9 +77,2 @@ | ||
} | ||
else if (options.port || options.host) { | ||
this.client = redis.createClient( | ||
options.port || default_port, | ||
options.host || default_host, | ||
options | ||
); | ||
} | ||
else { | ||
@@ -131,3 +120,3 @@ this.client = redis.createClient(options); | ||
RedisStore.prototype.__proto__ = Store.prototype; | ||
util.inherits(RedisStore, Store); | ||
@@ -177,3 +166,3 @@ /** | ||
var store = this; | ||
var psid = store.prefix + sid; | ||
var args = [store.prefix + sid]; | ||
if (!fn) fn = noop; | ||
@@ -188,19 +177,16 @@ | ||
if (store.disableTTL) { | ||
args.push(jsess); | ||
if (!store.disableTTL) { | ||
var ttl = getTTL(store, sess); | ||
args.push('EX', ttl); | ||
debug('SET "%s" %s ttl:%s', sid, jsess, ttl); | ||
} else { | ||
debug('SET "%s" %s', sid, jsess); | ||
store.client.set(psid, jsess, function (er) { | ||
if (er) return fn(er); | ||
debug('SET complete'); | ||
fn.apply(null, arguments); | ||
}); | ||
return; | ||
} | ||
var ttl = getTTL(store, sess); | ||
debug('SETEX "%s" ttl:%s %s', sid, ttl, jsess); | ||
store.client.setex(psid, ttl, jsess, function (er) { | ||
store.client.set(args, function (er) { | ||
if (er) return fn(er); | ||
debug('SETEX complete'); | ||
fn.apply(this, arguments); | ||
debug('SET complete'); | ||
fn.apply(null, arguments); | ||
}); | ||
@@ -207,0 +193,0 @@ }; |
{ | ||
"name": "connect-redis", | ||
"description": "Redis session store for Connect", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -17,3 +17,3 @@ "contributors": [ | ||
"debug": "^2.2.0", | ||
"redis": "^2.0.1" | ||
"redis": "^2.1.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
@@ -89,2 +89,6 @@ var P = require('bluebird'); | ||
var urlStore = new RedisStore({ url: 'redis://127.0.0.1:8888' }); | ||
t.equal(urlStore.client.address, '127.0.0.1:8888', 'sets url address'); | ||
urlStore.client.end(); | ||
var hostNoPort = new RedisStore({ host: 'host' }); | ||
@@ -98,3 +102,3 @@ t.equal(hostNoPort.client.address, 'host:6379', 'sets default port'); | ||
test('interups', function (t) { | ||
var store = P.promisifyAll(new RedisStore({ port: 8543 })); | ||
var store = P.promisifyAll(new RedisStore({ port: 8543, connect_timeout: 500 })); | ||
return store.setAsync('123', { cookie: { maxAge: 2000 }, name: 'tj' }) | ||
@@ -101,0 +105,0 @@ .catch(function (er) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17413
327
Updatedredis@^2.1.0