gitmyhub

ioredis

TypeScript ★ 15k updated 12d ago

🚀 A robust, performance-focused, and full-featured Redis client for Node.js.

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.

TypeScriptNode.jsnpmsetup: easycomplexity 2/5

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.

Where it fits