Skip to content

Commit

Permalink
Added an option 'client' to reuse an existing redis Client
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fritz committed Oct 24, 2011
1 parent 32e59fb commit ee34fd9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/connect-redis.js
Expand Up @@ -45,11 +45,17 @@ module.exports = function(connect){
this.prefix = null == options.prefix
? 'sess:'
: options.prefix;
this.client = new redis.createClient(options.port || options.socket, options.host, options);
if (options.pass) {
this.client.auth(options.pass, function(err){
if (err) throw err;
});
console.log("CLIENT", options.client);
if(options.client) {
this.client = options.client;
}
else {
this.client = new redis.createClient(options.port || options.socket, options.host, options);
if (options.pass) {
this.client.auth(options.pass, function(err){
if (err) throw err;
});
}
}

if (options.db) {
Expand Down

0 comments on commit ee34fd9

Please sign in to comment.