redis /ioredis
🚀 A robust, performance-focused, and full-featured Redis client for Node.js.
★ 15,355⑂ 1,274👁 153⑃ 753● 1,527▤ 176
More from this author
+0
Daily
+1
Weekly
+11
Monthly
15,355
stars
1,274
forks
153
watchers
753
prs
1,527
issues
176
releases
README
A robust, performance-focused and full-featured Redis client for Node.js.
Supports Redis = 2.6.12. Completely compatible with Redis 7.x.
ioredis is a stable project and maintenance is done on a best-effort basis for relevant issues (contributions to ioredis will still be evaluated, reviewed, and merged when they benefit the project). For new projects, node-redis is the recommended client library. node-redis is the open-source (MIT license) Redis JavaScript client library redesigned from the ground up and actively maintained. node-redis supports new (hash-field expiration) and future commands and the capabilities available in Redis Stack and Redis 8 (search, JSON, time-series, probabilistic data structures).
Features
ioredis is a robust, full-featured Redis client that is
used in the world's biggest online commerce company Alibaba and many other awesome companies.
0. Full-featured. It supports Cluster, Sentinel, Streams, Pipelining, and of course Lua scripting, Redis Functions, Pub/Sub (with the support of binary messages).
1. High performance 🚀.
2. Delightful API 😄. It works with Node callbacks and Native promises.
3. Transformation of command arguments and replies.
4. Transparent key prefixing.
5. Abstraction for Lua scripting, allowing you to define custom commands.
6. Supports binary data.
7. Supports TLS 🔒.
8. Supports offline queue and ready checking.
9. Supports ES6 types, such as Map and Set.
10. Supports GEO commands 📍.
11. Supports Redis ACL.
12. Sophisticated error handling strategy.
13. Supports NAT mapping.
14. Supports autopipelining.
100% written in TypeScript and official declarations are provided:
Versions
| Version | Branch | Node.js Version | Redis Version |
| -------------- | ------ | --------------- | --------------- |
| 6.x.x (latest) | main | = 20 | 6.2 ~ latest |
| 5.x.x | v5 | = 12 | 2.6.12 ~ latest |
| 4.x.x | v4 | = 8 | 2.6.12 ~ 7 |
Refer to CHANGELOG.md for features and bug fixes introduced in v5.
🚀 Upgrading from v5 to v6
🚀 Upgrading from v4 to v5
Links
- API Documentation (Redis, Cluster)
- Changelog
Quick Start
Install
shell
npm install ioredis
In a TypeScript project, you may want to add TypeScript declarations for Node.js:
shell
npm install --save-dev @types/node
Basic Usage
javascript
// Import ioredis.
// You can also use import { Redis } from "ioredis"
// if your project is a TypeScript project,
// Note that import Redis from "ioredis" is still supported,
// but will be deprecated in the next major version.
const Redis = require("ioredis");
// Create a Redis instance.
// By default, it will connect to localhost:6379.
// We are going to cover how to specify connection options soon.
const redis = new Redis();
redis.set("mykey", "value"); // Returns a promise which resolves to "OK" when the command succeeds.
// ioredis supports the node.js callback style
redis.get("mykey", (err, result) = {
if (err) {
Top issues
#1390Unhandled error event: Error: All sentinels are unreachable. Retrying from scratch after 10ms.30 comments · 2021-07-25#587Cluster: Fail to reconnect to node25 comments · 2018-02-16#634Client waiting endlessly for info from unresponsive server22 comments · 2018-05-30#358Handle "LOADING Redis is loading the dataset in memory"20 comments · 2016-08-15#1576Unhandled error event: Error: getaddrinfo ENOTFOUND - AWS ElasticCache17 comments · 2022-05-05#1183Uncaught Exception in tls when using aws lambda with elastic redis cache15 comments · 2020-08-18#610Blocking calls not working as expected in the case of disconnections13 comments · 2018-03-25#1285Blocking not working properly in case of reconnections11 comments · 2021-02-05
Latest release
v6.0.0 v6.0.0 2026-07-316.0.0 (2026-07-31) Add RESP3 (2127) (5d0862e) Bug Fixes clear stale socket timeout on reconnect (2148) (6455dbe) cluster: recreate stale connection on circular MOVED (2135) (08c8967) cluster: validate MOVED slot to prevent Array.prototype pollution (2151) (9618206), closes 1267 command: serialize large integer arguments in decimal notation (2136) (09b8d04) redis: keep reconnecting when connection closes during client setup (2099) (2123) (f9a66bc) sentinel: preserve zero preferred slave priority (2129) (a3f9f2d) tracing: redact values for GETSET and PSETEX (2134) (832765d) types: