NodeRedis
Node.js Redis integration backed by redis (node-redis).
This module creates a scoped node-redis client and exposes it in two forms:
the generic Redis service and the NodeRedis service for direct
access to the underlying client. layer accepts node-redis client options
directly, while layerConfig reads them from Effect config. node-redis
connects explicitly, so layer construction can fail with a RedisError.
Both layers close the client when the layer scope ends.
Layers
Provides Redis and NodeRedis services backed by a node-redis client
created with the supplied options, connected when the layer is built and
closed when the layer scope ends.
Details
By default, the initial connection fails on its first connection error. A
caller-supplied socket.reconnectStrategy is used instead when present. Once
the client has emitted ready, the default reconnect strategy uses
node-redis' exponential backoff and stops on socket timeouts.
Scope finalization calls close(), which waits for in-flight commands,
including blocking commands, and can therefore delay scope closure.
Signature
declare function layer(options?: any): Layer<NodeRedis | Redis, RedisError>layerConfig
Provides Redis and NodeRedis services from Config-backed node-redis
client options, connecting the client when the layer is built and closing it
when the layer scope ends.
Details
By default, the initial connection fails on its first connection error. A
caller-supplied socket.reconnectStrategy is used instead when present. Once
the client has emitted ready, the default reconnect strategy uses
node-redis' exponential backoff and stops on socket timeouts.
Scope finalization calls close(), which waits for in-flight commands,
including blocking commands, and can therefore delay scope closure.
Signature
declare const layerConfig: (options: Config.Wrap<NodeRedisClientOptions>) => Layer.Layer<Redis.Redis | NodeRedis, Redis.RedisError | Config.ConfigError>Services
Service tag for the Node Redis integration, exposing the underlying
node-redis client and a use helper that maps client failures to
RedisError.
Signature
declare class NodeRedis extends Shape<"@effect/platform-node/NodeRedis", { readonly client: any; readonly use: <A>(f: (client: any) => Promise<A>) => Effect<A, RedisError>;}, this> { constructor(_: never);}