ioredis
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@ioredis/commands | 1.2.0 | 5.74 kB | MIT | prod | |
cluster-key-slot | 1.1.2 | 5.13 kB | Apache-2.0 | prod | |
debug | 4.3.4 | 12.94 kB | MIT | prod | |
denque | 2.1.0 | 9.01 kB | Apache-2.0 | prod | |
lodash.defaults | 4.2.0 | 6.12 kB | MIT | prod | |
lodash.isarguments | 3.1.0 | 3.23 kB | MIT | prod | |
redis-errors | 1.2.0 | 3.27 kB | MIT | prod | |
redis-parser | 3.0.0 | 8.27 kB | MIT | prod | |
standard-as-callback | 2.1.0 | 2.42 kB | MIT | prod |
ioredis is a robust, high-performance and fully-featured Redis client for Node.js. This client supports Redis version 2.6.12 and up, including the latest Dragonfly version. It offers support for essential Redis features like Cluster, Sentinel, Streams, Pipelining, Lua scripting, and Pub/Sub to name a few. Functionality also expands to TLS support, error handling strategies, and tools to handle binary data. It is utilized by large companies like Alibaba, suggesting its reliability and capacity to handle large scale applications.
Usage of ioredis is quite simple and intuitive. First, install the package via npm using npm install ioredis
. After installation, import and initialize your Redis instance. Pass connection information to the instance if your Redis server is not running on localhost:6379
. Here's a simple code example:
const Redis = require("ioredis");
const redis = new Redis();
// Use the redis instance to set key-value pairs.
redis.set("mykey", "value");
redis.get("mykey", (err, result) => {
if (err) {
console.error(err);
} else {
console.log(result); // Prints "value"
}
});
redis.zadd("sortedSet", 1, "one", 2, "dos", 4, "quatro", 3, "three");
redis.zrange("sortedSet", 0, 2, "WITHSCORES").then((elements) => {
console.log(elements);
});
Detailed usage examples are provided within an examples/
folder in the ioredis repository.
You can find the detailed documentation for ioredis at this URL: https://luin.github.io/ioredis/. The documentation covers a wide range of topics, from basic uses to complex features like pipelining, transactions, and Lua scripting. It also dives into error handling, Pub/Sub functionality, TLS options, and more. Every feature is elaborated with explanation and code snippets for a better understanding. This documentation is the go-to resource to answer all your queries and understand best the practices for using ioredis.