lib/redisstore.js
function RedisStore(port, host, options) {
	port = port || 6379;
	host = host || '127.0.0.1';
	this._options = options || {};
	this._options.redisstore = this._options.redisstore || {};
	if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) {
		throw new Error('database has to be a number (if provided at all)');
	} else if(this._options.redisstore.database) {
		this._database = this._options.redisstore.database;
	} else {
		this._database = 0;
	}

	this._tokenKey = this._options.redisstore.tokenkey || 'pwdless:';
	delete this._options.redisstore;

	this._client = redis.createClient(port, host, this._options);
}
function RedisStore(port, host, options) {
	port = port || 6379;
	host = host || '127.0.0.1';
	this._options = options || {};
	this._options.redisstore = this._options.redisstore || {};
	if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) {
		throw new Error('database has to be a number (if provided at all)');
	} else if(this._options.redisstore.database) {
		this._database = this._options.redisstore.database;
	} else {
		this._database = 0;
	}

	this._tokenKey = this._options.redisstore.tokenkey || 'pwdless:';
	delete this._options.redisstore;

	this._client = redis.createClient(port, host, this._options);
}
function RedisStore ( port , host , options ) { port = port || 6379 ; host = host || '127.0.0.1' ; this . _options = options || { } ; this . _options . redisstore = this . _options . redisstore || { } ; if ( this . _options . redisstore . database && ! isNumber ( this . _options . redisstore . database ) ) { throw new Error ( 'database has to be a number (if provided at all)' ) ; } else if ( this . _options . redisstore . database ) { this . _database = this . _options . redisstore . database ; } else { this . _database = 0 ; } this . _tokenKey = this . _options . redisstore . tokenkey || 'pwdless:' ; delete this . _options . redisstore ; this . _client = redis . createClient ( port , host , this . _options ) ; }
Constructor of RedisStore
@param {Number} [port] Port of the Redis server (default: 6379)
@param {String} [host] Host, e.g. 127.0.0.1 (default: 127.0.0.1)
@param {Object} [options] Combines both the options for the Redis client as well
as the options for RedisStore. For the Redis options please refer back to
the documentation: https://github.com/NodeRedis/node_redis. RedisStore accepts
the following options: (1) { redisstore: { database: Number }} number of the
Redis database to use (default: 0), (2) { redisstore: { tokenkey: String }} the
prefix used for the RedisStore entries in the database (default: 'pwdless:')
@constructor
Constructor of RedisStore