Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connect-redis

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-redis - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

.npmignore

5

History.md
1.3.0 / 2012-03-23
==================
* Added debug() instrumentation
1.2.0 / 2011-11-17

@@ -3,0 +8,0 @@ ==================

17

lib/connect-redis.js

@@ -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": "*" }
}

@@ -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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc