🗄️
Database3M+/wkMIT

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
npm install ioredis
yarn
yarn add ioredis
pnpm
pnpm add ioredis

Import

ESM
import Redis from 'ioredis';

Quick Example

usage
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

Packageioredis
CategoryDatabase
Weekly Downloads3M+
LicenseMIT
Installnpm install ioredis

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.