code: function connectToRedis(db, opts) {
  
      // get the redis client
      var client = redis.createClient(opts.port, opts.host);
  
      // log any errors
      client.on('error', function (err) {
          redisOffline = true;
          console.log('connectToRedis error: ' + err);
      });
  
      client.on('ready', function () {
          redisOffline = false;
      });
  
      // if there is a password, do auth
      var deferred = Q.defer();
      if (opts.password) {
          client.auth(opts.password, function (authErr) {
              if (authErr) {
                  deferred.reject(authErr);
                  return;
              }
  
              client.select(db, function (err) {
                  err ? deferred.reject(err) : deferred.resolve(client);
              });
          });
      }
      else {
          client.select(db, function (err) {
              err ? deferred.reject(err) : deferred.resolve(client);
          });
      }
  
      return deferred.promise;
  }
docs: Create a connection to redis and select the appropriate database
  @param db
  @param opts
  @returns {*}