/** * Redis-backed implementation of the `TokenCacheStore` contract. * * Ported from `src/proxy/cache/redis-cache.ts`. Self-contained — only depends * on the `redis` npm client and the contract-interface types; the extension's * tracing/logging are supplied by `ExtensionContext.logger` at setup time. * * @module extensions/ext-cache-redis/redis-cache */ import { type RedisClientType } from "redis"; import type { TokenCacheEntry, TokenCacheStats, TokenCacheStore } from "veryfront/extensions/cache"; /** Constructor options for `RedisTokenCacheStore`. */ export interface RedisTokenCacheStoreOptions { url: string; prefix?: string; connectTimeout?: number; tls?: boolean; password?: string; username?: string; } /** Minimal logger surface; satisfies the `ExtensionLogger` shape. */ export interface RedisCacheLogger { debug(message: string, ...args: unknown[]): void; info(message: string, ...args: unknown[]): void; warn(message: string, ...args: unknown[]): void; error(message: string, ...args: unknown[]): void; } /** Factory contract used by tests — swap in an in-memory stub. */ export type RedisClientFactory = (opts: Record) => RedisClientType; export declare class RedisTokenCacheStore implements TokenCacheStore { private client; private readonly prefix; private readonly url; private readonly connectTimeout; private readonly tls; private readonly password?; private readonly username?; private readonly logger; private readonly clientFactory; private hits; private misses; private connected; constructor(options: RedisTokenCacheStoreOptions, deps?: { logger?: RedisCacheLogger; clientFactory?: RedisClientFactory; }); private key; get(key: string): Promise; set(key: string, entry: TokenCacheEntry): Promise; delete(key: string): Promise; clear(): Promise; has(key: string): Promise; stats(): Promise; close(): Promise; private getConnectedClient; private ensureConnected; } //# sourceMappingURL=redis-cache.d.ts.map