connect-redis
Advanced tools
Comparing version 1.2.0 to 1.3.0
1.3.0 / 2012-03-23 | ||
================== | ||
* Added debug() instrumentation | ||
1.2.0 / 2011-11-17 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -0,4 +1,5 @@ | ||
/*! | ||
* Connect - Redis | ||
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca> | ||
* Copyright(c) 2012 TJ Holowaychuk <tj@vision-media.ca> | ||
* MIT Licensed | ||
@@ -11,3 +12,4 @@ */ | ||
var redis = require('redis'); | ||
var redis = require('redis') | ||
, debug = require('debug')('connect:redis'); | ||
@@ -49,2 +51,3 @@ /** | ||
: options.prefix; | ||
this.client = options.client || new redis.createClient(options.port || options.socket, options.host, options); | ||
@@ -84,6 +87,9 @@ if (options.pass) { | ||
sid = this.prefix + sid; | ||
debug('GET "%s"', sid); | ||
this.client.get(sid, function(err, data){ | ||
try { | ||
if (!data) return fn(); | ||
fn(null, JSON.parse(data.toString())); | ||
data = data.toString(); | ||
debug('GOT %s', data); | ||
fn(null, JSON.parse(data)); | ||
} catch (err) { | ||
@@ -112,3 +118,6 @@ fn(err); | ||
, sess = JSON.stringify(sess); | ||
this.client.setex(sid, ttl, sess, function(){ | ||
debug('SETEX "%s" ttl:%s %s', sid, sess); | ||
this.client.setex(sid, ttl, sess, function(err){ | ||
err || debug('SETEX complete'); | ||
fn && fn.apply(this, arguments); | ||
@@ -115,0 +124,0 @@ }); |
{ | ||
"name": "connect-redis", | ||
"description": "Redis session store for Connect", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"main": "./index.js", | ||
"dependencies": { "redis": ">= 0.0.1" }, | ||
"devDependencies": { "connect": "1.4.x" }, | ||
"engines": { "node": ">= 0.1.98" } | ||
"dependencies": { "redis": "*", "debug": "*" }, | ||
"devDependencies": { "connect": "*" }, | ||
"engines": { "node": "*" } | ||
} |
39
test.js
@@ -24,35 +24,8 @@ | ||
// #length() | ||
store.length(function(err, len){ | ||
assert.ok(!err, '#length() got an error'); | ||
assert.equal(1, len, '#length() with keys'); | ||
// #db option | ||
store_alt.length(function (err, len) { | ||
assert.ok(!err, '#alt db got an error'); | ||
assert.equal(0, len, '#alt db with keys'); | ||
// #clear() | ||
store.clear(function(err, ok){ | ||
assert.ok(!err, '#clear()'); | ||
assert.ok(ok, '#clear()'); | ||
// #length() | ||
store.length(function(err, len){ | ||
assert.ok(!err, '#length()'); | ||
assert.equal(0, len, '#length() without keys'); | ||
// #set null | ||
store.set('123', { cookie: { maxAge: 2000 }, name: 'tj' }, function(){ | ||
store.destroy('123', function(){ | ||
store.length(function(err, len){ | ||
assert.equal(0, len, '#set() null'); | ||
console.log('done'); | ||
store.client.end(); | ||
store_alt.client.end(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
// #set null | ||
store.set('123', { cookie: { maxAge: 2000 }, name: 'tj' }, function(){ | ||
store.destroy('123', function(){ | ||
console.log('done'); | ||
store.client.end(); | ||
store_alt.client.end(); | ||
}); | ||
@@ -59,0 +32,0 @@ }); |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
18077
2
160
2
+ Addeddebug@*
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)
Updatedredis@*