Registry / database / node-redis-connection-pool

node-redis-connection-pool

JSON →
library3.1.0jsnpmunverified

A simplistic Redis connection pool for Node.js, leveraging generic-pool for scalable connection management. Current stable version is 3.1.0, with releases following minor version bumps. It provides a seamless abstraction over node_redis (redis client v4+) with features like automatic connection pooling, graceful shutdown, and support for custom logging. Key differentiators include simplicity, TypeScript types shipped, and dependency on redis v4+ using UNLINK and replicate_commands for pattern deletion. Compared to alternatives like redis-pool or ioredis, it focuses on minimal configuration and direct pool control.

npm install node-redis-connection-pool
INSTALL
IMPORT
SIG · NODE-REDIS-CONNECT
N
node-redis-connection-pool
databasejavascriptv3.1.0
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.

RedisPool
import { RedisPool } from 'node-redis-connection-pool'
const RedisPool = require('node-redis-connection-pool')
ESM import is correct. CommonJS require is still supported but deprecated in favor of ESM.
RedisPoolOptions
import type { RedisPoolOptions } from 'node-redis-connection-pool'
Type import for options type definition; available via shipped types.
pool
const pool = new RedisPool(); await pool.sendCommand('set', ['key', 'value']);
Default usage: instantiate RedisPool and use sendCommand for Redis commands.

Demonstrates creating a RedisPool, sending SET and GET commands, and properly draining the pool.

import { RedisPool } from 'node-redis-connection-pool'; async function main() { const pool = new RedisPool({ redisOptions: { host: 'localhost', port: 6379 }, poolOptions: { min: 2, max: 10 } }); try { const result = await pool.sendCommand('set', ['foo', 'bar']); console.log('SET result:', result); const value = await pool.sendCommand('get', ['foo']); console.log('GET result:', value); } catch (err) { console.error('Error:', err); } finally { await pool.drain(); await pool.clear(); } } main();
Debug
Known issues
breakingRequires Node.js >=8 and redis >=4. Older Node.js or redis versions are incompatible.
fix
Update Node.js to >=8 and redis (npm package) to >=4.
affects: >=3.0.0
breakingDependency on node_redis's UNLINK and replicate_commands(). If your Redis server doesn't support these, operations will fail.
fix
Ensure Redis server version >=4.0.0 or use a compatible alternative.
affects: >=3.0.0
deprecatedCommonJS require('node-redis-connection-pool') is deprecated in favor of ESM imports.
fix
Use import { RedisPool } from 'node-redis-connection-pool' instead of require.
affects: >=3.1.0
gotchaPool must be drained and cleared on application exit to prevent hanging connections.
fix
Call pool.drain() then pool.clear() before process exit.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: pool.sendCommand is not a function
Using import incorrectly or pool is not instantiated properly.
fix
Ensure you use `new RedisPool()` and import correctly: `import { RedisPool } from 'node-redis-connection-pool'`
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or wrong host/port.
fix
Start Redis server or provide correct host/port in redisOptions.
Error: The command 'UNLINK' is not supported by your Redis server
Redis server version is older than 4.0.0.
fix
Upgrade Redis server to version >=4.
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
generic-poolrequiredProvides the underlying connection pooling mechanism
redisrequiredCore Redis client dependency; version 4+ required for UNLINK and replicate_commands
node_redisrequiredAbstraction over native Redis client (compatible with redis v4)
Agent activity
5 hits · last 30 days
node
4
Resources
node-redis-connection-pool — npm install node-redis-connection-pool · libregistry