/** * Fixture-based Response Cache for Tests * * Stores all cached API responses in a single .json.gz file. * Designed for test fixtures that can be shared across multiple tests. * * Features: * - Single compressed file for all cache entries * - Load once at test start, save at end * - Additive: new entries are added to existing fixture * - No TTL: fixtures never expire * - Thread-safe: can be shared across tests * * Usage: * ```ts * const cache = new FixtureCache('tests/fixtures/embeddings.json.gz') * await cache.load() * * // Use with any ResponseCache-compatible function * const result = await messageEmbeddings(messages, config, cache) * * // Save after tests (adds new entries to fixture) * await cache.save() * ``` */ import type { CachedResponse, ResponseCache } from '../caching/types'; /** * Fixture-based cache that stores all entries in a single .json.gz file. * * - Implements ResponseCache for use with embeddings, classifier, geocoder * - Ignores TTL (fixtures never expire) * - Additive: loads existing, adds new entries, saves back */ export declare class FixtureCache implements ResponseCache { private readonly fixturePath; private entries; private dirty; private loaded; private createdAt; constructor(fixturePath: string); /** * Load fixture from disk. Call before using the cache. * If file doesn't exist, starts with empty cache. */ load(): Promise; /** * Save fixture to disk. Call after tests complete. * Only writes if new entries were added. */ save(): Promise; /** * Get cached response by hash. * Returns null if not found (triggers API call in production code). */ get(hash: string): Promise | null>; /** * Store response in cache. */ set(hash: string, response: CachedResponse): Promise; /** * Check if a key exists in the cache. */ has(hash: string): boolean; /** * Get the number of cached entries. */ get size(): number; /** * Check if there are unsaved changes. */ get isDirty(): boolean; /** * Get all cached hashes (for debugging/inspection). */ keys(): string[]; /** * Clear all entries (for testing). */ clear(): void; } //# sourceMappingURL=fixture-cache.d.ts.map