Skip to content

NodeRedis

Node.js Redis integration backed by ioredis.

This module creates a scoped ioredis client and exposes it in two forms: the generic Redis service and the NodeRedis service for direct access to the underlying client. layer accepts ioredis options directly, while layerConfig reads them from Effect config. Both layers close the client when the layer scope ends.

3 exports Added in v4.0.0 Source

Layers

layer

Added in v4.0.0 Source

Provides Redis and NodeRedis services backed by an ioredis client created with the supplied options and closed when the layer scope ends.

Signature

declare function layer(options?: any): Layer<NodeRedis | Redis>;

layerConfig

Added in v4.0.0 Source

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

Signature

declare const layerConfig: (
  options: Config.Wrap<IoRedis.RedisOptions>,
) => Layer.Layer<Redis.Redis | NodeRedis, Config.ConfigError>;

Services

NodeRedis

Added in v4.0.0 Source

Service tag for the Node Redis integration, exposing the underlying ioredis client and a use helper that maps client failures to RedisError.

Signature

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