Lightning-fast, lightweight and reliable Redis client for Bun, Cloudflare Workers, Deno and web browsers.
import { RedisClient } from "@iuioiua/redis";
import { assertEquals } from "@std/assert/equals";
using redisConn = await Deno.connect({ port: 6379 });
const redisClient = new RedisClient(redisConn);
const reply1 = await redisClient.sendCommand(["SET", "hello", "world"]);
assertEquals(reply1, "OK");
const reply2 = await redisClient.sendCommand(["GET", "hello"]);
assertEquals(reply2, "world");
- Supports RESPv2, RESP3, raw data, pipelining, pub/sub, transactions and Lua scripts.
- Compatible with timeouts and retries.
- One of the fastest Redis clients in Deno.
- Written to be easily understood and debugged.
- Encourages the use of actual Redis commands without intermediate abstractions.
This package currently doesn't correctly read replies that contain CRLF (\r\n
)
within the message. For example, if a bulk string contains a CRLF, it'll only
return the message, up to that CLRF. The simple workaround for this is to use LF
(\n
) for delimiting newlines, instead of CRLF.
If this issue affects you, please open a new issue. Otherwise, this issue is a "won't fix".
Like Italian cooking, the design of this package is defined by what it doesn't do rather than what it does do. It doesn't extend the functionality of a TCP connection. It doesn't implement a method for each Redis command, of which there are hundreds. Instead, the Redis client consumes a TCP connection, lets the user write Redis commands, and returns the parsed result according to the RESP data type. The result is a design with fewer moving parts, fewer bugs, less maintenance, and a smaller footprint than other JavaScript implementations of Redis clients.
Module | Size (KB) | Dependencies |
---|---|---|
jsr:@iuioiua/redis | 25.25 | 5 |
jsr:@db/redis | 214.31 | 34 |
npm:ioredis | 897.71 | 10 |
npm:redis | 968.17 | 9 |
Note: Results were produced using
deno info <module>
on February 16, 2025.