/** * Response Cache - In-memory cache with TTL for reducing redundant requests * * Useful for: * - Avoiding re-fetching the same page during a session * - Reducing load on government websites * - Speeding up development/testing iterations */ interface CacheOptions { ttlMs?: number; maxEntries?: number; } export declare class ResponseCache { private cache; private ttlMs; private maxEntries; constructor(options?: CacheOptions); /** * Generate a cache key from URL and optional parameters */ private generateKey; /** * Get a cached value if it exists and hasn't expired */ get(url: string, params?: Record): T | undefined; /** * Store a value in the cache */ set(url: string, value: T, params?: Record, ttlMs?: number): void; /** * Check if a URL is cached (and not expired) */ has(url: string, params?: Record): boolean; /** * Remove a specific entry from the cache */ delete(url: string, params?: Record): boolean; /** * Remove all expired entries */ cleanup(): number; /** * Evict the oldest entries to make room */ private evictOldest; /** * Clear the entire cache */ clear(): void; /** * Clear cache entries for a specific domain * @param domain - Domain to clear entries for (e.g., 'example.com') * @returns Number of entries removed */ clearDomain(domain: string): number; /** * Get all unique domains in the cache */ getDomains(): string[]; /** * Get cache statistics */ getStats(): { size: number; maxEntries: number; ttlMs: number; oldestEntry: number | null; newestEntry: number | null; }; /** * Wrap an async function with caching */ withCache(url: string, fn: () => Promise, params?: Record, ttlMs?: number): Promise; } /** * Specialized cache for HTML content with content hash tracking */ export declare class ContentCache extends ResponseCache<{ html: string; contentHash: string; fetchedAt: number; }> { constructor(options?: CacheOptions); /** * Simple hash function for content comparison */ static hashContent(content: string): string; /** * Check if content has changed since last cache */ hasContentChanged(url: string, newContent: string): boolean; } export declare const pageCache: ContentCache; export declare const apiCache: ResponseCache; export {}; //# sourceMappingURL=cache.d.ts.map