ioredis
ioredis is a robust, performance-focused Redis client for Node.js that supports Redis Cluster, Sentinel, Streams, and Lua scripting with a feature-rich API. Cre…
Installation
npm install ioredis
yarn add ioredis
pnpm add ioredis
Import
import Redis from 'ioredis';
Quick Example
import Redis from 'ioredis';
const redis = new Redis('redis://localhost:6379');
await redis.set('key', 'value');
const value = await redis.get('key');
// Pipeline for batch operations
const pipeline = redis.pipeline();
pipeline.set('a', '1');
pipeline.set('b', '2');
await pipeline.exec();About ioredis
ioredis is a robust, performance-focused Redis client for Node.js that supports Redis Cluster, Sentinel, Streams, and Lua scripting with a feature-rich API. Created as an alternative to the official node-redis client, ioredis has been widely adopted for production Redis usage due to its reliability, comprehensive feature set, and excellent cluster support. The library automatically handles cluster topology changes, slot migration, and multi-key commands that span multiple cluster nodes. ioredis provides transparent pipelining that batches commands sent in the same event loop tick into a single network request, significantly improving throughput. The client supports all Redis data structures and commands, pub/sub with automatic resubscription on reconnection, Lua script caching and evaluation, offline queue for commands sent before connection, and customizable retry strategies. ioredis includes built-in support for Redis Sentinel for automatic failover, stream reading with consumer groups, and module commands. The API is mostly compatible with node-redis but adds convenience methods like mset/mget with object arguments and pipeline/multi transaction builders. ioredis has recently become part of the official Redis organization on GitHub, solidifying its position as a first-class Redis client.
Quick Facts
| Package | ioredis |
| Category | Database |
| Weekly Downloads | 3M+ |
| License | MIT |
| Install | npm install ioredis |
Related Packages
redis (node-redis) is the official Redis client for Node.js, providing a full-featured interface to …
Express is the most widely used web application framework for Node.js, providing a minimal and flexi…
Socket.IO is a library that enables low-latency, bidirectional, and event-based communication betwee…
Mongoose is the most popular Object Data Modeling (ODM) library for MongoDB and Node.js, providing a…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.