redis-connection-pool
Advanced tools
Comparing version 1.5.1 to 1.6.0
var indexSectionsWithContent = { | ||
"Functions": { | ||
"Files": { | ||
"Symbols": false, | ||
"Numbers": false, | ||
"A": false, | ||
"B": true, | ||
"C": true, | ||
"D": true, | ||
"E": true, | ||
"B": false, | ||
"C": false, | ||
"D": false, | ||
"E": false, | ||
"F": false, | ||
"G": true, | ||
"H": true, | ||
"I": true, | ||
"G": false, | ||
"H": false, | ||
"I": false, | ||
"J": false, | ||
"K": false, | ||
"L": true, | ||
"L": false, | ||
"M": false, | ||
"N": false, | ||
"O": true, | ||
"O": false, | ||
"P": false, | ||
"Q": false, | ||
"R": true, | ||
"S": true, | ||
"S": false, | ||
"T": false, | ||
@@ -62,24 +62,24 @@ "U": false, | ||
}, | ||
"Files": { | ||
"Functions": { | ||
"Symbols": false, | ||
"Numbers": false, | ||
"A": false, | ||
"B": false, | ||
"C": false, | ||
"D": false, | ||
"E": false, | ||
"B": true, | ||
"C": true, | ||
"D": true, | ||
"E": true, | ||
"F": false, | ||
"G": false, | ||
"H": false, | ||
"I": false, | ||
"G": true, | ||
"H": true, | ||
"I": true, | ||
"J": false, | ||
"K": false, | ||
"L": false, | ||
"L": true, | ||
"M": false, | ||
"N": false, | ||
"O": false, | ||
"O": true, | ||
"P": false, | ||
"Q": false, | ||
"R": true, | ||
"S": false, | ||
"S": true, | ||
"T": false, | ||
@@ -86,0 +86,0 @@ "U": false, |
{ | ||
"name": "redis-connection-pool", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "a redis client connection pool", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -28,2 +28,4 @@ node-redis-connection-pool | ||
port: 6379, //default | ||
// optionally specify full redis url, overrides host + port properties | ||
// url: "redis://username:password@host:port" | ||
max_clients: 30, // defalut | ||
@@ -30,0 +32,0 @@ perform_checks: false, // checks for needed push/pop functionality |
@@ -46,2 +46,4 @@ /** | ||
* | ||
* cfg.url - (string) - [optional] Complete Redis URL (overrides host and port) | ||
* | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
@@ -71,2 +73,8 @@ * once. (default: 30) | ||
if (typeof cfg.url === 'string') { | ||
this.url = cfg.url; | ||
this.host = undefined; | ||
this.port = undefined; | ||
} | ||
this.blocking_support = true; | ||
@@ -82,3 +90,8 @@ this.version_array = undefined; | ||
create: function (callback) { | ||
var client = redis.createClient(self.port, self.host, self.options); | ||
var client; | ||
if (self.url) { | ||
client = redis.createClient(self.url, self.options); | ||
} else { | ||
client = redis.createClient(self.port, self.host, self.options); | ||
} | ||
client.__name = "client" + i; | ||
@@ -93,3 +106,3 @@ i = i + 1; | ||
}); | ||
client.on('ready', function () { | ||
@@ -182,3 +195,3 @@ client.select(self.database, function (err) { | ||
* key - (string) - A key whose TTL(time-to-expire) has to be returned | ||
* | ||
@@ -435,3 +448,3 @@ */ | ||
* command_name - (string) - The redis command to execute | ||
* args - (array) - The arguments to the redis command | ||
* args - (array) - The arguments to the redis command | ||
* cb - (function) - Callback to be executed on completion | ||
@@ -621,3 +634,8 @@ * | ||
var self = this; | ||
var client = redis.createClient(self.port, self.host); | ||
var client; | ||
if (self.url) { | ||
client = redis.createClient(self.url); | ||
} else { | ||
client = redis.createClient(self.port, self.host); | ||
} | ||
try { | ||
@@ -624,0 +642,0 @@ client.on('error', function (err) { |
@@ -32,7 +32,7 @@ if (typeof define !== 'function') { | ||
test.assertAnd(env.redisPool.uid, 'redisPoolTests1'); | ||
env.redisPool.serverInfo(function (err, serverInfo) { | ||
test.assert(serverInfo.database, 0); | ||
}); | ||
}, | ||
@@ -59,3 +59,3 @@ takedown: function (env, test) { | ||
test.assertAnd(env.redisPool.uid, 'redisPoolTests2'); | ||
env.redisPool.serverInfo(function (err, serverInfo) { | ||
@@ -92,2 +92,26 @@ test.assert(serverInfo.database, 7); | ||
} | ||
}, | ||
{ | ||
desc: 'connect using URL property', | ||
run: function (env, test) { | ||
env.redisPool = env.RedisPool('redisPoolTestsURL', { | ||
url: "redis://localhost:6379", | ||
max_clients: 12, | ||
perform_checks: true | ||
}); | ||
test.assertAnd(env.redisPool.url, 'redis://localhost:6379'); | ||
test.assertTypeAnd(env.redisPool.host, "undefined"); | ||
test.assert(env.redisPool.max_clients, 12); | ||
env.redisPool.serverInfo(function (err, serverInfo) { | ||
test.assert(serverInfo.database, 0); | ||
}); | ||
}, | ||
takedown: function (env, test) { | ||
env.redisPool.clean(env.channel + '*', function () { | ||
test.result(true); | ||
}); | ||
delete env.redisPool; | ||
} | ||
} | ||
@@ -94,0 +118,0 @@ ] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
299128
3767
118