/** * Query Result Caching * * In-memory Map-based cache for database queries. No external dependencies * (Redis, Memcached, etc.) - RevealUI uses PostgreSQL + ElectricSQL/PGlite * for all persistence and sync. */ interface CacheOptions { ttl?: number; prefix?: string; tags?: string[]; } interface CacheStats { hits: number; misses: number; sets: number; deletes: number; hitRate: number; } /** * Cache a query result */ export declare function cacheQuery(key: string, queryFn: () => Promise, options?: CacheOptions): Promise; /** * Invalidate cache by key */ export declare function invalidateCache(key: string): void; /** * Invalidate cache by pattern */ export declare function invalidateCachePattern(pattern: string): void; /** * Invalidate cache by tags */ export declare function invalidateCacheTags(tags: string[]): void; /** * Clear all cache */ export declare function clearCache(): void; /** * Get cache statistics */ export declare function getCacheStats(): CacheStats; /** * Cache for list queries */ export declare function cacheList(resource: string, filters: Record, queryFn: () => Promise, ttl?: number): Promise; /** * Cache for single item queries */ export declare function cacheItem(resource: string, id: string | number, queryFn: () => Promise, ttl?: number): Promise; /** * Cache for count queries */ export declare function cacheCount(resource: string, filters: Record, queryFn: () => Promise, ttl?: number): Promise; /** * Invalidate resource cache */ export declare function invalidateResource(resource: string): void; /** * Warm cache with data */ export declare function warmCache(key: string, data: T, ttl?: number): void; /** * Get cached value without executing query */ export declare function getCached(key: string): T | null; /** * Check if key exists in cache */ export declare function cacheExists(key: string): boolean; /** * Memoize function with cache */ export declare function memoize Promise>(fn: T, options?: CacheOptions): T; /** * Create cache wrapper for query function */ export declare function withCache Promise>(queryFn: T, options: { keyFn: (...args: Parameters) => string; ttl?: number; prefix?: string; }): T; /** * Batch cache operations */ export declare function batchCache(operations: Array<{ key: string; queryFn: () => Promise; ttl?: number; }>): Promise; /** * Cache with stale-while-revalidate pattern */ export declare function cacheSWR(key: string, queryFn: () => Promise, options?: { ttl?: number; staleTime?: number; }): Promise; export {}; //# sourceMappingURL=query-cache.d.ts.map