1import type * as Effect from "effect/Effect";
2import * as Binding from "../Binding.ts";
3import type { ReadClient } from "../Redis/index.ts";
4import type { Redis } from "./Redis.ts";
5
6/**
7 * Bind a {@link Redis} database with read access (`get`, `ping`).
8 *
9 * `ReadRedis` is the Context tag, the type, and the callable —
10 * `yield* Railway.ReadRedis(Cache)`. Provide {@link ReadRedisHttp}.
11 *
12 *
13 * ### Read
14 * **Example:** Get a key
15 * ```typescript
16 * const cache = yield* Railway.ReadRedis(Cache);
17 * const value = yield* cache.get("marker");
18 * ```
19 *
20 * @binding
21 * @product Redis
22 */
23export interface ReadRedis extends Binding.Service<
24 ReadRedis,
25 "Railway.ReadRedis",
26 (redis: Redis) => Effect.Effect<ReadRedisClient>
27> {}
28
29export const ReadRedis = Binding.Service<ReadRedis>("Railway.ReadRedis");
30
31export type ReadRedisClient = ReadClient;