Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-connection-pool

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-connection-pool - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

12

package.json
{
"name": "redis-connection-pool",
"version": "1.1.0",
"version": "1.2.0",
"description": "a redis client connection pool",

@@ -25,9 +25,9 @@ "license": "MIT",

"debug": "^2.1.0",
"generic-pool": "^2.0.4",
"hiredis": "^0.1.17",
"q": "^0.9.7",
"redis": "^0.9.2"
"generic-pool": "^2.2.0",
"hiredis": "^0.4.1",
"q": "^1.4.1",
"redis": "^1.0.0"
},
"devDependencies": {
"jaribu": "^0.2.2"
"jaribu": "^2.0.0"
},

@@ -34,0 +34,0 @@ "repository": {

@@ -12,7 +12,6 @@ node-redis-connection-pool

## About
node-redis-connection-pool is high-level redis management object. It manages
node-redis-connection-pool is a high-level redis management object. It manages
a number of connections in a pool, using them as needed and keeping all aspects
of releasing active connections internal to the object, so the user does not
need to worry about forgotten connections leaking memory and building up over
time.
need to worry about forgotten connections leaking resources.

@@ -28,7 +27,8 @@ ## Installation

```javascript
var redisPool = require('redis-connection-pool')('myRedisPool',{
host: '127.0.0.1', //default
var redisPool = require('redis-connection-pool')('myRedisPool', {
host: '127.0.0.1', // default
port: 6379, //default
max_clients: 30, //defalut
perform_checks: false, //checks for needed push/pop functionality
max_clients: 30, // defalut
perform_checks: false, // checks for needed push/pop functionality
database: 0, // database number to use
options: {

@@ -35,0 +35,0 @@ auth_pass: 'password'

/**
* redis-connection-pool.js
*
* copyright 2012-2014 Nick Jennings (https://github.com/silverbucket)
* copyright 2012-2015 Nick Jennings (https://github.com/silverbucket)
*

@@ -54,2 +54,5 @@ * licensed under the MIT license.

*
* cfg.database - (number) - if you prefer a specific database number for this
* pool, you can specify that here (default: 0)
*
* Returns:

@@ -66,2 +69,3 @@ *

this.options = (typeof cfg.options === 'object') ? cfg.options : null;
this.database = (typeof cfg.database === 'number') ? cfg.database : 0;

@@ -82,8 +86,14 @@ this.blocking_support = true;

self.database = self.database || 0;
debug('selecting database ' + self.database);
client.on('error', function (err) {
debug(err);
});
client.on('ready', function () {
callback(null, client);
client.select(self.database, function (err) {
debug('2. selected database: ' + client.selected_db);
callback(null, client);
});
});

@@ -130,2 +140,21 @@ },

/**
* Function: serverInfo
*
* Get server info
*
* Parameters: none
*
*/
RedisConnectionPool.prototype.serverInfo = function (cb) {
var pool = this.pool;
pool.acquire(function (err, client) {
var serverInfo = client.server_info;
serverInfo.database = client.selected_db;
pool.release(client);
cb(null, serverInfo);
});
};
/**
* Function: expire

@@ -132,0 +161,0 @@ *

@@ -8,3 +8,69 @@ if (typeof define !== 'function') {

suites.push({
suites.push(
{
name: "database connection tests",
desc: "testing states of database connectivity",
abortOnFail: true, // don't continue with further test suites if any tests in this suite fail
setup: function (env, test) {
env.RedisPool = require('./../src/redis-connection-pool');
env.channel = "redis-connection-pool-tests:";
test.done();
},
tests: [
{
desc: 'connect to database',
run: function (env, test) {
env.redisPool = env.RedisPool('redisPoolTests1', {
host: '127.0.0.1',
port: 6379,
max_clients: 60,
perform_checks: true
});
test.assertTypeAnd(env.redisPool, 'object');
test.assertAnd(env.redisPool.uid, 'redisPoolTests1');
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;
}
},
{
desc: 'connect to database 7',
run: function (env, test) {
env.redisPool = env.RedisPool('redisPoolTests2', {
host: '127.0.0.1',
port: 6379,
max_clients: 60,
perform_checks: true,
database: 7
});
test.assertTypeAnd(env.redisPool, 'object');
test.assertAnd(env.redisPool.uid, 'redisPoolTests2');
env.redisPool.serverInfo(function (err, serverInfo) {
test.assert(serverInfo.database, 7);
});
},
takedown: function (env, test) {
env.redisPool.clean(env.channel + '*', function () {
test.result(true);
});
delete env.redisPool;
}
}
]
},
{
name: "redis tests",

@@ -11,0 +77,0 @@ desc: "collection of basic redis-connection-pool tests",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc