Registry / database / redis-mpool

redis-mpool

JSON →
library0.8.2jsnpmunverified

redis-mpool (v0.8.2) provides connection pool management for Redis databases in Node.js applications. It wraps the node_redis client to create a pool of connections, handling acquisition, release, and automatic reconnection. The library is maintained by CartoDB and has a modest release cadence. It differentiates from generic pooling libraries by being Redis-specific, offering built-in error handling and pool health checks tailored to Redis. Note: This package has not been updated since 2020 and may lack support for newer Redis features like Redis 6 ACLs or TLS connections.

npm install redis-mpool
INSTALL
IMPORT
SIG · REDIS-MPOOL
R
redis-mpool
databasejavascriptv0.8.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.

default
import RedisPool from 'redis-mpool'
const RedisPool = require('redis-mpool').RedisPool
Default export is the RedisPool constructor. CommonJS users should use const RedisPool = require('redis-mpool').
RedisPool
import RedisPool from 'redis-mpool'
const { RedisPool } = require('redis-mpool')
Named export does not exist; the module exports a single constructor as default.
PoolStatus
import { PoolStatus } from 'redis-mpool'
const PoolStatus = require('redis-mpool').PoolStatus
PoolStatus is a named export for pool status constants. Available from version 0.7.0 onwards.

Shows creating a Redis connection pool with custom options, acquiring a client, performing a Redis GET command, and releasing the client back to the pool.

import RedisPool from 'redis-mpool'; const pool = new RedisPool({ host: process.env.REDIS_HOST || 'localhost', port: parseInt(process.env.REDIS_PORT) || 6379, max: 10, min: 2, idleTimeoutMillis: 30000, reapIntervalMillis: 1000, redisOptions: { auth_pass: process.env.REDIS_PASS || '' } }); async function example() { const client = await pool.acquire(); try { const reply = await new Promise((resolve, reject) => { client.get('mykey', (err, res) => { if (err) reject(err); else resolve(res); }); }); console.log(reply); } finally { pool.release(client); } } example().catch(console.error);
Debug
Known issues
deprecatedpackage 'redis-mpool' is deprecated. Use 'ioredis' with built-in connection pooling or 'redis' v4 with clustering instead.
fix
Migrate to ioredis or redis@4 with 'createClient' which includes built-in connection pooling.
affects: >=0.0.0
breakingPool options changed between versions: 'max' and 'min' replaced 'maxConnections' and 'minConnections'. Update your pool configuration.
fix
Use 'max' and 'min' integer properties in pool config.
affects: >=0.6.0
gotchaThe pool does not automatically reconnect after Redis server restart; clients may become stale. You must detect and discard stale clients manually.
fix
Implement a health check or use a library like 'ioredis' that handles reconnection transparently.
affects: >=0.0.0
breakingThe 'auth_pass' option is no longer supported in redis > 3.0. Use 'password' instead.
fix
Pass 'password' in redisOptions instead of 'auth_pass'.
affects: >=0.7.0
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or unreachable.
fix
Start Redis server with 'redis-server' or check host/port.
TypeError: pool.acquire is not a function
Using an older version of redis-mpool where the method was named 'getConnection'.
fix
Upgrade to version 0.6.0+ and use pool.acquire().
Error: The pool is full and no resources are available
All connections in the pool are in use and the pool max size is reached.
fix
Increase the 'max' pool option or ensure clients are released after use.
Upgrade
Version history
0.8.2latest on npm
Audit
Dependencies
redisrequiredThe underlying Redis client used by the pool
generic-poolrequiredProvides the generic connection pool implementation
Agent activity
15 hits · last 30 days
node
14
Resources
redis-mpool — npm install redis-mpool · libregistry