explaingit

redis/ioredis

15,264TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A full-featured Redis client library for Node.js that supports Redis Cluster, Sentinel, pub/sub, pipelining, Lua scripting, and TLS, note: now in maintenance mode, new projects should use node-redis instead.

Mindmap

mindmap
  root((ioredis))
    What it does
      Talk to Redis from Node.js
      Promises and callbacks
      Binary data support
    Connection types
      Single Redis server
      Redis Cluster
      Redis Sentinel
    Features
      Pipelining for speed
      Pub/Sub messaging
      Lua scripting
      TLS encryption
    Status
      Maintenance mode
      node-redis recommended
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Connect a Node.js backend to Redis for caching database query results using promises or async/await syntax.

USE CASE 2

Build pub/sub messaging between Node.js services using ioredis's subscribe and publish commands.

USE CASE 3

Talk to a Redis Cluster from Node.js with automatic sharding and failover handled by ioredis.

Tech stack

TypeScriptNode.jsnpm

Getting it running

Difficulty · easy Time to first run · 30min

Requires a running Redis server, the library is in maintenance mode, new projects should use node-redis per the maintainers' recommendation.

Not specified in the explanation.

In plain English

ioredis is a Redis client library for Node.js, written in TypeScript. Redis is a fast in-memory data store that programs use to keep things like cached query results, session info, counters, or message queues, a client library is the piece of code your application uses to talk to it. The README describes ioredis as robust, performance-focused, and full-featured, and says it is used at Alibaba and other large companies. The README lists the features it covers: connecting to a single Redis server, to Redis Cluster (Redis split across many machines), and to Redis Sentinel (a high-availability setup), as well as Streams, Pipelining (batching commands for speed), Pub/Sub (publish-subscribe messaging, including binary payloads), Lua scripting, and Redis Functions. It exposes both Node.js callbacks and native promises, so you can write either style, and it includes things like transparent key prefixing, TLS encryption support, ACL support, an offline queue, autopipelining, and binary data handling. Connection options can be passed as a host and port, a redis:// URL, or a unix socket path. You would use ioredis when you are building a Node.js application and need to read from or write to Redis. Important caveat from the README itself: ioredis is now in best-effort maintenance mode, and for new projects the maintainers recommend a sibling library called node-redis, which they say has been redesigned and supports newer Redis features. It is installed through npm and works with Node.js 12 or newer for the latest version. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
I want to cache database query results in Redis from my Node.js Express app using ioredis. Show me how to connect to Redis, store a query result with a 60-second TTL, and retrieve it on the next request.
Prompt 2
I want to build a real-time notification system using ioredis pub/sub in Node.js. Show me a publisher script and a subscriber script that listen for messages on a channel.
Prompt 3
I'm using ioredis to connect to a Redis Cluster in Node.js. Show me the connection config for a 3-node cluster and how to set and get a key while ioredis handles which shard to use.
Prompt 4
ioredis is now in maintenance mode. Show me how to migrate an existing ioredis connection and basic get/set/expire commands to the node-redis library they recommend instead.
Open on GitHub → Explain another repo

← redis on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.