Registry / database / pool-redis

pool-redis

JSON →
library0.1.2jsnpmunverified

A lightweight Node.js module for pooling Redis connections, built on top of the node_redis client. Version 0.1.2 is the latest stable release, but the package appears abandoned (no updates since 2014). It provides a simple API to manage a pool of Redis clients with configurable host, port, password, and max connections. Unlike modern alternatives like ioredis with built-in connection management, pool-redis requires manual release of clients via a callback pattern. It exposes methods like getClient(), release(), close(), and closeAll().

npm install pool-redis
INSTALL
IMPORT
SIG · POOL-REDIS
P
pool-redis
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

poolRedis initializer
const poolRedis = require('pool-redis')({ host: 'localhost', password: '', maxConnections: 10 });
const poolRedis = require('pool-redis').createPool({ host: 'localhost' });
The module exports a function that must be called with options to create a pool instance. There is no named export; it is a single default function.
getClient
poolRedis.getClient(function(client, done) { /* use client */ done(); });
poolRedis.getClient().then(client => { client.get('key', (err, val) => {}); });
getClient uses a callback pattern, not Promises. The second argument 'done' must be called to release the client back to the pool.
release
poolRedis.release(client);
poolRedis.release(client, (err) => {});
release is synchronous and does not accept a callback. It simply returns the client to the pool.
close
poolRedis.close(client);
poolRedis.destroy(client);
close removes and closes the client connection. There is no destroy method.

Demonstrates creating a pool, getting a client, performing SET and GET operations, releasing the client, and closing all connections.

const poolRedis = require('pool-redis')({ host: process.env.REDIS_HOST ?? 'localhost', password: process.env.REDIS_PASSWORD ?? '', maxConnections: 10 }); // Get a client from the pool poolRedis.getClient(function(client, done) { // Use the client like a normal node_redis client client.set('key', 'value', function(err, reply) { if (err) throw err; console.log('SET reply:', reply); }); client.get('key', function(err, value) { if (err) throw err; console.log('GET value:', value); }); // Release the client back to the pool done(); }); // Close all clients when done (ensure no pending operations) setTimeout(() => { poolRedis.closeAll(); }, 1000);
Debug
Known issues
deprecatedThis package is abandoned and no longer maintained. It was last updated in 2014. Use modern Redis clients like ioredis or redis v4+ which include built-in connection pooling.
fix
Migrate to ioredis with its built-in Cluster or redis v4 with generic-pool.
affects: *
gotchaThe module requires the 'redis' package (node_redis) as an implicit dependency. You must install it separately.
fix
Run 'npm install redis' alongside 'npm install pool-redis'.
affects: *
gotchaThe getClient callback pattern is error-prone: forgetting to call done() will leak connections and eventually exhaust the pool.
fix
Always call done() in the callback, or use try/finally if nested callbacks.
affects: *
breakingThe option 'handleRedisError' defaults to false. If not enabled, unhandled redis errors will crash the Node process.
fix
Set handleRedisError: true in the pool options to suppress errors via console.error.
affects: *
Errors
Common errors & fixes
Cannot find module 'redis'
pool-redis requires the 'redis' package but does not list it as a peer dependency.
fix
Run 'npm install redis' to install the required dependency.
TypeError: poolRedis.getClient is not a function
Forgetting to call the exported function with options - poolRedis is the function itself, not a pool instance.
fix
Use: const pool = require('pool-redis')({...}); then pool.getClient(...);
Error: Connection closed by remote host.
Trying to use a client after it has been released back to the pool or closed.
fix
Ensure all operations on a client are completed before calling done() or release().
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
redisrequiredpool-redis requires the node_redis (redis) package as a peer dependency to create and manage Redis clients.
Agent activity
9 hits · last 30 days
node
8
Resources
pool-redis — npm install pool-redis · libregistry