/** * Completion Cache * * A simple in-memory cache with TTL support for completion data. */ export declare class CompletionCache { private cache; private ttl; /** * Create a new completion cache * @param ttl Time-to-live in milliseconds (default: 60000 = 1 minute) */ constructor(ttl?: number); /** * Get a cached value or load it using the provided loader function * @param key Cache key * @param loader Async function to load the value if not cached * @returns Cached or newly loaded value */ getOrLoad(key: string, loader: () => Promise): Promise; /** * Get a cached value synchronously (returns undefined if not cached or expired) * @param key Cache key * @returns Cached value or undefined */ get(key: string): T | undefined; /** * Set a cached value * @param key Cache key * @param value Value to cache * @param customTtl Optional custom TTL for this entry */ set(key: string, value: T, customTtl?: number): void; /** * Check if a key exists and is not expired * @param key Cache key * @returns Whether the key exists and is valid */ has(key: string): boolean; /** * Invalidate cache entries matching a pattern * @param pattern Optional pattern to match keys (if not provided, clears all) */ invalidate(pattern?: string): void; /** * Get the number of entries in the cache (including expired ones) */ get size(): number; /** * Clear all expired entries * @returns Number of entries removed */ cleanup(): number; }