Skip to content

DenoRedis

Deno Redis integration backed by @db/redis.

This module creates a scoped, native Deno Redis client and exposes it as both the portable Redis service and the Deno-specific DenoRedis service for direct access to the raw client. Unlike Bun's built-in client, @db/redis connects eagerly using RESP2, so layer construction can fail with a RedisError.

4 exports Added in v4.0.0 Source

Layers

layer

Added in v4.0.0 Source

Provides Redis and DenoRedis services backed by an @db/redis client, closing the client when the layer scope ends. URL-derived options can be overridden by other supplied options.

Signature

declare function layer(options?: RedisOptions): Layer<DenoRedis | Redis, RedisError>;

layerConfig

Added in v4.0.0 Source

Provides Redis and DenoRedis services from Config-backed options, closing the client when the layer scope ends.

Signature

declare function layerConfig(
  options: Config<RedisOptions>,
): Layer<DenoRedis | Redis, ConfigError | RedisError>;

Models

RedisOptions type

Added in v4.0.0 Source

Options for connecting to Redis, including a Redis URL or individual connection settings. Explicit settings override values from the URL.

Signature

type RedisOptions = Omit<RedisConnectOptions, "hostname"> & {
  readonly hostname?: string;
  readonly url?: string;
};

Services

DenoRedis

Added in v4.0.0 Source

Service tag for Deno Redis integration, exposing the raw @db/redis client and a use helper that maps client promise failures to RedisError.

Signature

declare class DenoRedis extends Shape<
  "@effect/platform-deno/DenoRedis",
  {
    readonly client: RedisClient;
    readonly use: <A>(f: (client: RedisClient) => Promise<A>) => Effect<A, RedisError>;
  },
  this
> {
  constructor(_: never);
}