{"id":46093,"library":"redis-connection-pool","title":"Redis Connection Pool","description":"A connection pooling library for Redis in Node.js, version 4.0.1. It manages a configurable number of Redis connections internally, distributing requests across available connections and handling release automatically. This package wraps the popular 'redis' client library and exposes a simplified subset of Redis commands (get, set, hgetall, lpush, etc.) plus a sendCommand method for arbitrary commands. It is TypeScript-ready with full type definitions. Release cadence is low (sporadic) but the API is stable. Compared to manual pool management, this library abstracts all acquisition and release logic, reducing boilerplate and common errors like forgetting to return connections.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/silverbucket/node-redis-connection-pool","tags":["javascript","redis","client","database","connection","pool","manager","typescript"],"install":[{"cmd":"npm install redis-connection-pool","lang":"bash","label":"npm"},{"cmd":"yarn add redis-connection-pool","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-connection-pool","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying Redis client dependency (v4.x). Required for all Redis operations.","package":"redis","optional":false}],"imports":[{"note":"The package exports a default export that is a factory function. Named import will result in undefined.","wrong":"import { redisPoolFactory } from 'redis-connection-pool'","symbol":"default (factory function)","correct":"import redisPoolFactory from 'redis-connection-pool'"},{"note":"The class is also the default export (the factory is the default, but the class itself is accessible via default export). Named import will not work. Use 'new RedisConnectionPool()' after importing the default.","wrong":"import { RedisConnectionPool } from 'redis-connection-pool'","symbol":"RedisConnectionPool class","correct":"import RedisConnectionPool from 'redis-connection-pool'"},{"note":"In CommonJS, the default export is assigned to module.exports, so destructuring will fail. Use default require.","wrong":"const { redisPoolFactory } = require('redis-connection-pool')","symbol":"CommonJS require","correct":"const redisPoolFactory = require('redis-connection-pool')"}],"quickstart":{"code":"import redisPoolFactory from 'redis-connection-pool';\n\n// Create a pool with 3 max clients, connecting to localhost\nconst redisPool = await redisPoolFactory('myPool', {\n  max_clients: 3,\n  redis: {\n    url: process.env.REDIS_URL || 'redis://localhost:6379'\n  }\n});\n\n// Use standard Redis commands\nawait redisPool.set('user:1000:name', 'Alice');\nconst name = await redisPool.get('user:1000:name');\nconsole.log(name); // Alice\n\n// Use sendCommand for any other Redis command\nconst info = await redisPool.sendCommand('INFO', ['server']);\nconsole.log(info);\n\n// Clean up when done\nredisPool.shutdown();","lang":"typescript","description":"Creates a Redis connection pool, sets and gets a key, executes a custom command via sendCommand, and shuts down the pool."},"warnings":[{"fix":"Update to >=4.0.0 and adapt configuration: replace 'host'/'port' options with 'url' or 'socket' object. Also ensure your code uses async/await or promises instead of callbacks.","message":"In version 4.0.0, the underlying 'redis' client was upgraded from v3 to v4. This change is breaking because v4 switched from callbacks to promises and changed the configuration format.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Await the call to redisPoolFactory or use .then(). Old code that assigned the result synchronously will receive a Promise instead of the pool object.","message":"The factory function is now async in v4.0.0+ (returns a Promise). Previously it was synchronous.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Ensure all commands have resolved before calling shutdown, e.g., by awaiting all your Redis calls or using a counter.","message":"The pool's shutdown() method does not wait for pending operations to complete before closing connections. In-flight commands may fail with 'Connection closed' errors.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Call the default export as a function (with await) or import the class directly (import RedisConnectionPool from 'redis-connection-pool').","message":"Default export is a factory function, not the class. Using new default() will fail because the default is not a constructor.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'4.0.1':13 'abstract':86 'acquisit':88 'across':25 'api':76 'arbitrari':58 'automat':31 'avail':26 'boilerpl':93 'cadenc':70 'client':38,104 'command':47,59 'common':95 'compar':79 'configur':17 'connect':2,5,21,27,101,106 'databas':105 'definit':68 'distribut':23 'error':96 'etc':52 'expos':41 'forget':98 'full':66 'get':48 'handl':29 'hgetal':50 'intern':22 'javascript':102 'librari':7,39,85 'like':97 'logic':91 'low':72 'lpush':51 'manag':15,83,108 'manual':81 'method':56 'node.js':11 'number':18 'packag':33 'plus':53 'pool':3,6,82,107 'popular':36 'readi':64 'redi':1,9,20,37,46,103 'reduc':92 'releas':30,69,90 'request':24 'return':100 'sendcommand':55 'set':49 'simplifi':43 'sporad':73 'stabl':78 'subset':44 'type':67 'typescript':63,109 'typescript-readi':62 'version':12 'wrap':34","created_at":"2026-06-07T12:58:15.949819+00:00","updated_at":"2026-06-07T12:58:15.949819+00:00","problems":[{"fix":"Use await: const redisPool = await redisPoolFactory('pool', options);","cause":"The default import is a factory function returning a Promise, not the pool itself. Code that calls factory without await gets a Promise, not a pool.","error":"TypeError: redisPool.get is not a function"},{"fix":"Ensure you are not using the pool after shutdown. Check your Redis server availability and network.","cause":"Attempting to use the pool after shutdown() has been called, or the underlying Redis connection dropped.","error":"Error: The client is closed"},{"fix":"Upgrade to >=4.0.0 and ensure the pool is correctly initialized. sendCommand was added in v4.","cause":"Using an older version (<4.0.0) where sendCommand was not exposed as a method. Or the pool was not initialized properly.","error":"TypeError: redisPool.sendCommand is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://silverbucket.github.io/redis-connection-pool","github":"git://github.com/silverbucket/node-redis-connection-pool","docs":null,"changelog":null,"pypi":null,"npm":"redis-connection-pool","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}