{"id":45162,"library":"ioredis-conn-pool","title":"ioredis-conn-pool","description":"ioredis-conn-pool is a Redis connection pool implementation based on ioredis and generic-pool, designed to simplify the management of Redis client connections in Node.js applications. Current stable version is 2.0.1. It uses generic-pool for robust connection lifecycle management with configurable min/max pool size, and relies on ioredis for Redis protocol handling. Compared to alternatives like redis-pool or simple ioredis client reuse, it provides a higher-level API that abstracts acquire/release patterns and supports TypeScript out of the box. Released under MIT license.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/fengxinming/ioredis-conn-pool","tags":["javascript","redis","ioredis","redis-client","redis-pool","typescript"],"install":[{"cmd":"npm install ioredis-conn-pool","lang":"bash","label":"npm"},{"cmd":"yarn add ioredis-conn-pool","lang":"bash","label":"yarn"},{"cmd":"pnpm add ioredis-conn-pool","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Redis client dependency for executing commands","package":"ioredis","optional":false},{"reason":"Provides connection pool logic (acquire, release, drain)","package":"generic-pool","optional":false}],"imports":[{"note":"Named export, not default. ESM and TypeScript both use named import.","wrong":"import RedisPool from 'ioredis-conn-pool'","symbol":"RedisPool","correct":"import { RedisPool } from 'ioredis-conn-pool'"},{"note":"Type import is fine but not wrong; the library ships types so you can use either.","wrong":"import type { RedisPoolOptions } from 'ioredis-conn-pool'","symbol":"RedisPoolOptions","correct":"import { RedisPoolOptions } from 'ioredis-conn-pool'"},{"note":"There is no default export. Always use named import.","wrong":"import RedisPool from 'ioredis-conn-pool'","symbol":"default"}],"quickstart":{"code":"import { RedisPool } from 'ioredis-conn-pool';\n\nconst pool = new RedisPool({\n  redis: {\n    host: process.env.REDIS_HOST ?? '127.0.0.1',\n    port: Number(process.env.REDIS_PORT ?? 6379),\n    password: process.env.REDIS_PASSWORD ?? ''\n  },\n  pool: {\n    min: 2,\n    max: 10\n  }\n});\n\nasync function todo() {\n  let client;\n  try {\n    client = await pool.getConnection();\n    await client.set('test', 'redis test');\n    const result = await client.get('test');\n    console.log('Saved successfully', result);\n  } catch (e) {\n    console.error(e);\n  } finally {\n    if (client) {\n      await pool.release(client);\n      console.log('Released');\n    }\n  }\n  await pool.end();\n  console.log('Closed all connections');\n}\n\ntodo();","lang":"typescript","description":"Shows how to create a RedisPool, acquire a connection, execute commands, release it, and close the pool."},"warnings":[{"fix":"Use try...finally block to ensure release.","message":"Always release the client back to the pool using pool.release(client) after use to avoid resource leaks.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Call pool.end() instead of client.disconnect().","message":"Do not manually close the ioredis client; use pool.end() to drain and close all connections gracefully.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Wrap min/max inside a pool: {} object.","message":"The pool configuration changed between v1 and v2: v2 uses 'pool' sub-object while v1 used flat options like 'min' and 'max'.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Always await pool.end().","message":"Calling pool.end() without awaiting is deprecated; it returns a Promise since v2.","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"search_vec":"'2.0.1':38 'abstract':82 'acquire/release':83 'altern':64 'api':80 'applic':33 'base':15 'box':91 'client':29,72,101 'compar':62 'configur':50 'conn':3,7 'connect':12,30,46 'current':34 'design':22 'generic':20,42 'generic-pool':19,41 'handl':61 'higher':78 'higher-level':77 'implement':14 'ioredi':2,6,17,57,71,98 'ioredis-conn-pool':1,5 'javascript':96 'level':79 'licens':95 'lifecycl':47 'like':65 'manag':26,48 'min/max':51 'mit':94 'node.js':32 'pattern':84 'pool':4,8,13,21,43,52,68,104 'protocol':60 'provid':75 'redi':11,28,59,67,97,100,103 'redis-cli':99 'redis-pool':66,102 'releas':92 'reli':55 'reus':73 'robust':45 'simpl':70 'simplifi':24 'size':53 'stabl':35 'support':86 'typescript':87,105 'use':40 'version':36","created_at":"2026-06-07T12:53:40.151787+00:00","updated_at":"2026-06-07T12:53:40.151787+00:00","problems":[{"fix":"Run npm install ioredis-conn-pool and ensure the import path is correct: 'ioredis-conn-pool'.","cause":"Package not installed or import path typo.","error":"Error: Cannot find module 'ioredis-conn-pool'"},{"fix":"Use import { RedisPool } from 'ioredis-conn-pool'.","cause":"Using default import instead of named import.","error":"TypeError: pool.getConnection is not a function"},{"fix":"Check Redis configuration and ensure server is reachable.","cause":"Wrong host/port or Redis server not running.","error":"Error: Redis connection refused"}],"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://fengxinming.github.io/ioredis-conn-pool","github":"ssh://git@github.com/fengxinming/ioredis-conn-pool","docs":null,"changelog":null,"pypi":null,"npm":"ioredis-conn-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}}