Skip to main content

r2d2

Simple, lightweight Redis client library for Deno.

import { sendCommand } from "https://deno.land/x/r2d2/mod.ts";

const redisConn = await Deno.connect({ port: 6379 });

/** Resolves to "OK" */
await sendCommand(redisConn, ["SET", "hello", "world"]);

/** Prints "world" */
console.log(await sendCommand(redisConn, ["GET", "hello"]));

redisConn.close();

Features

  • Stateless commands
  • Pipelining
  • Pub/sub

Principles

  1. Designed to be fundamentally simple
  2. Takes advantage of native Deno APIs and Deno’s standard library without custom classes
  3. Promotes using Redis commands without intermediate abstractions

Prerequisites

Redis must be installed on your local machine (guide here). Doing so enables the use of the redis-server CLI tool, which is used to start a local Redis server for testing and benchmarks.

Testing

deno task test

Benchmarks

deno task bench