Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitRedis

Bun

Connect to Redis from Bun over TCP, TLS or a Unix socket with RedisBun.

RedisBun has the same constructors and options as RedisNode, but opens its sockets with Bun.connect. Import it from @effect-kit/redis/bun.

Example (Creating the Bun Layer)

import {  } from "effect";
import {  } from "@effect-kit/redis";
import {  } from "@effect-kit/redis/bun";

const  = .({ : "redis://localhost:6379" });

const  = .(function* () {
  const  = yield* ;
  return yield* .();
});

export const  = .(.());

Creating the layer

ConstructorBuilds a layer for
RedisBun.layer, RedisBun.layerConfigOne standalone server
RedisBun.layerCluster, RedisBun.layerClusterConfigA cluster
RedisBun.layerSentinel, RedisBun.layerSentinelConfigA Sentinel deployment

The layer export is the transport

layer exported from @effect-kit/redis/bun is the transport, not a client. Build clients with RedisBun.layer(...).

Provided services

RedisBun.layer provides the same services as RedisNode.layer.

Example (The Services a Bun Layer Provides)

import type {  } from "effect";
import {  } from "@effect-kit/redis/bun";

const  = .({ : "redis://localhost:6379" });

type Provided = .<typeof >;
type Provided = BatchExecutor | CommandExecutor | Crypto | Redis | RedisAdmin | RedisCredentials | RedisPubSub | RedisScripts | RedisSessions | RedisStreams

Transport options

The transport uses Bun.connect for TCP, TLS and Unix sockets. The url, endpoint and tls shapes are the ones in Node.js, including serverName, ca, certificate, privateKey and rejectUnauthorized.

Example (Connecting Over a Unix Socket)

import {  } from "@effect-kit/redis/bun";

export const  = .({ : { : "/var/run/redis/redis.sock" } });

Cluster and Sentinel need TCP endpoints, as on Node.js.

Tested version

The package is tested on Bun 1.4.4, against Redis and Valkey, including Cluster, Sentinel and a Unix socket. The Unix socket test runs on Linux.