storages/redis.js
function RedisStorage(config) {
  
   var self = this;
   
   config = protos.extend({
     host: 'localhost',
     port: 6379,
     db: undefined,
     password: undefined
   }, config || {});
   
   app.debug(util.format('Initializing Redis Storage for %s:%s', config.host, config.port));
   
   this.db = 0;
   
   this.config = config;
   
   this.className = this.constructor.name;
   
   // Set redis client
   
   self.client = redis.createClient(config.port, config.host, config.options);

   // Authenticate if password provided
   if (config.password) self.client.auth(config.password);

   // Handle error event
   self.client.on('error', function(err) {
     throw err;
   });

   // Select db if specified
   if (typeof config.db == 'number' && config.db !== 0) {
     app.addReadyTask();
     self.db = config.db;
     self.client.select(config.db, function(err, res) {
       if (err) {
         throw err;
       } else {
         app.flushReadyTask();
       }
     });
   }

   // Set enumerable properties
   protos.util.onlySetEnumerable(this, ['className', 'db']);
}
function RedisStorage(config) {
  
   var self = this;
   
   config = protos.extend({
     host: 'localhost',
     port: 6379,
     db: undefined,
     password: undefined
   }, config || {});
   
   app.debug(util.format('Initializing Redis Storage for %s:%s', config.host, config.port));
   
   this.db = 0;
   
   this.config = config;
   
   this.className = this.constructor.name;
   
   // Set redis client
   
   self.client = redis.createClient(config.port, config.host, config.options);

   // Authenticate if password provided
   if (config.password) self.client.auth(config.password);

   // Handle error event
   self.client.on('error', function(err) {
     throw err;
   });

   // Select db if specified
   if (typeof config.db == 'number' && config.db !== 0) {
     app.addReadyTask();
     self.db = config.db;
     self.client.select(config.db, function(err, res) {
       if (err) {
         throw err;
       } else {
         app.flushReadyTask();
       }
     });
   }

   // Set enumerable properties
   protos.util.onlySetEnumerable(this, ['className', 'db']);
}
function RedisStorage ( config ) { var self = this ; config = protos . extend ( { host : 'localhost' , port : 6379 , db : undefined , password : undefined } , config || { } ) ; app . debug ( util . format ( 'Initializing Redis Storage for %s:%s' , config . host , config . port ) ) ; this . db = 0 ; this . config = config ; this . className = this . constructor . name ; // Set redis client self . client = redis . createClient ( config . port , config . host , config . options ) ; // Authenticate if password provided if ( config . password ) self . client . auth ( config . password ) ; // Handle error event self . client . on ( 'error' , function ( err ) { throw err ; } ) ; // Select db if specified if ( typeof config . db == 'number' && config . db !== 0 ) { app . addReadyTask ( ) ; self . db = config . db ; self . client . select ( config . db , function ( err , res ) { if ( err ) { throw err ; } else { app . flushReadyTask ( ) ; } } ) ; } // Set enumerable properties protos . util . onlySetEnumerable ( this , [ 'className' , 'db' ] ) ; }
Redis Storage class

@class RedisStorage
@extends Storage
@constructor
@param {object} app Application instance
@param {object} config Storage configuration
Redis Storage class