import { t as CacheAdapter } from "../cache.adapter-z0MMDFoK.js"; //#region src/adapters/redis.adapter.d.ts /** * Structural type for an ioredis-compatible client. * * Any client exposing these methods works — ioredis, ioredis-mock, * or a custom wrapper around another Redis driver. */ interface RedisLikeClient { get(key: string): Promise; set(key: string, value: string, ...args: unknown[]): Promise; del(...keys: string[]): Promise; scan(cursor: string | number, ...args: unknown[]): Promise<[string, string[]]>; incrby(key: string, increment: number): Promise; decrby(key: string, decrement: number): Promise; expire(key: string, seconds: number): Promise; exists(...keys: string[]): Promise; pipeline?(commands: unknown[][]): { exec(): Promise<[Error | null, unknown][]>; }; disconnect?(): void; } /** * Connection options for creating a new ioredis client. * Mirrors the most common ioredis constructor shapes. */ interface RedisAdapterOptions { /** * Redis connection URL (e.g. 'redis://localhost:6379') * or a port number. Defaults to ioredis defaults (localhost:6379). */ url?: string; /** * Additional ioredis options passed to the constructor. * Typed loosely to avoid a hard dependency on ioredis types. */ options?: Record; } /** * Redis cache adapter for the subscriptions package * * Wraps an ioredis client. JSON-serializes values, supports TTL, * atomic counters, and pattern deletion via SCAN + MATCH. * * Accepts either an existing client (recommended — you own the * connection lifecycle) or connection options, in which case the * `ioredis` package is lazy-loaded. * * @example * ```typescript * import { redisCacheAdapter } from '@abshahin/subscriptions/adapters/redis'; * import Redis from 'ioredis'; * * // With an existing client * const cache = redisCacheAdapter(new Redis()); * * // Or with connection options (lazy-loads ioredis) * const cache = redisCacheAdapter({ url: process.env.REDIS_URL }); * * const subs = createSubscriptions({ * database: prismaAdapter(db), * cache, * features: { ... }, * }); * ``` */ declare function redisCacheAdapter(redisOrOptions?: RedisLikeClient | RedisAdapterOptions): CacheAdapter; //#endregion export { RedisAdapterOptions, RedisLikeClient, redisCacheAdapter }; //# sourceMappingURL=redis.adapter.d.ts.map