Skip to content

Commit

Permalink
lazy load redis. fixes #56
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag04 committed Oct 28, 2013
1 parent de9a5a2 commit 30d7013
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/connect-redis.js
Expand Up @@ -8,8 +8,7 @@
* Module dependencies.
*/

var redis = require('redis')
, debug = require('debug')('connect:redis');
var debug = require('debug')('connect:redis');

/**
* One day in seconds.
Expand Down Expand Up @@ -49,7 +48,7 @@ module.exports = function(connect){
? 'sess:'
: options.prefix;

this.client = options.client || new redis.createClient(options.port || options.socket, options.host, options);
this.client = options.client || new require('redis').createClient(options.port || options.socket, options.host, options);
if (options.pass) {
this.client.auth(options.pass, function(err){
if (err) throw err;
Expand Down

1 comment on commit 30d7013

@freewil
Copy link

@freewil freewil commented on 30d7013 Apr 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not arguing against this change, but just for educational purposes, does this really change anything? If you are passing in a redis client, assumably, you've already require()d the redis module?

EDIT Ok, nevermind: see comment on #56, you could be using haredis

Please sign in to comment.