/** * Statistics about the current cache state. */ export interface CacheStats { /** Number of cached entries */ cacheSize: number; /** Number of pending fetch requests */ pendingRequests: number; /** Array of all cache keys */ keys: string[]; } /** * Generic data cache with promise deduplication. * * Provides in-memory caching with automatic request deduplication to prevent * multiple simultaneous fetches for the same key. */ export declare class DataCache { /** Map storing cached data by key */ static cache: Map; /** Map storing pending fetch promises by key */ static promises: Map>; /** * Gets data from cache or fetches if not cached. * * Automatically deduplicates concurrent requests for the same key. * * @param key - Cache key * @param fetcher - Function to fetch data if not cached * @returns Promise resolving to the cached or fetched data */ static get(key: string, fetcher: () => Promise): Promise; /** * Checks if a key exists in cache without fetching. * * @param key - Cache key to check * @returns True if key exists in cache */ static has(key: string): boolean; /** * Gets cached data synchronously without fetching. * * @param key - Cache key * @returns Cached data or undefined if not cached */ static peek(key: string): K | undefined; /** * Removes a specific cache entry. * * @param key - Cache key to remove */ static invalidate(key: string): void; /** * Clears all cached data and pending promises. */ static clear(): void; /** * Sets data directly in cache without fetching. * * @param key - Cache key * @param data - Data to cache * @returns Promise resolving to the cached data */ static set(key: string, data: K): Promise; /** * Gets cache statistics including size and pending requests. * * @returns Object with cache statistics */ static stats(): CacheStats; } /** * Initializes and returns a new widget cache instance. * * @returns A new DataCache instance */ export declare function initWidgetCache(): DataCache;