connect-redis
Advanced tools
Comparing version 1.0.7 to 1.1.0
1.1.0 / 2011-10-05 | ||
================== | ||
* Added `prefix` option | ||
* Removed `clear()` and `length()` methods | ||
1.0.7 / 2011-08-04 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -45,2 +45,5 @@ /*! | ||
Store.call(this, options); | ||
this.prefix = null == options.prefix | ||
? 'sess:' | ||
: options.prefix; | ||
this.client = new redis.createClient(options.port || options.socket, options.host, options); | ||
@@ -79,2 +82,3 @@ if (options.pass) { | ||
RedisStore.prototype.get = function(sid, fn){ | ||
sid = this.prefix + sid; | ||
this.client.get(sid, function(err, data){ | ||
@@ -100,2 +104,3 @@ try { | ||
RedisStore.prototype.set = function(sid, sess, fn){ | ||
sid = this.prefix + sid; | ||
try { | ||
@@ -123,28 +128,7 @@ var maxAge = sess.cookie.maxAge | ||
RedisStore.prototype.destroy = function(sid, fn){ | ||
sid = this.prefix + sid; | ||
this.client.del(sid, fn); | ||
}; | ||
/** | ||
* Fetch number of sessions. | ||
* | ||
* @param {Function} fn | ||
* @api public | ||
*/ | ||
RedisStore.prototype.length = function(fn){ | ||
this.client.dbsize(fn); | ||
}; | ||
/** | ||
* Clear all sessions. | ||
* | ||
* @param {Function} fn | ||
* @api public | ||
*/ | ||
RedisStore.prototype.clear = function(fn){ | ||
this.client.flushdb(fn); | ||
}; | ||
return RedisStore; | ||
}; |
{ | ||
"name": "connect-redis", | ||
"description": "Redis session store for Connect", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
@@ -18,2 +18,3 @@ | ||
- `pass` Password for Redis authentication | ||
- `prefix` Key prefix defaulting to "sess:" | ||
- ... Remaining options passed to the redis `createClient()` method. | ||
@@ -20,0 +21,0 @@ |
36
18467
177