/** * kosha-discovery — File-based JSON cache with TTL. * * Stores discovered provider data as individual JSON files on disk * to avoid re-fetching from provider APIs on every startup. * Each cache key maps to a `{key}.json` file inside the cache directory. * @module */ interface CacheEntry { data: T; timestamp: number; } /** * Simple file-based JSON cache with TTL support. * Stores discovered provider data to avoid re-fetching on every startup. * * Each cache key maps to a `{key}.json` file inside the cache directory. */ export declare class KoshaCache { private readonly cacheDir; constructor(cacheDir?: string); /** * Retrieve cached data by key. * Returns null if the entry is missing or the file cannot be read. */ get(key: string): Promise | null>; /** * Write data to the cache under the given key. * * Uses atomic write (temp file + rename) so a crash mid-write * cannot leave a corrupted cache file behind. */ set(key: string, data: T): Promise; /** * Remove a single cached entry by key. */ invalidate(key: string): Promise; /** * Remove all cache files from the cache directory. */ clear(): Promise; /** * Check whether a cached timestamp has exceeded the given TTL. */ isExpired(timestamp: number, ttlMs: number): boolean; /** * Sanitize a cache key into a safe filename and return the full path. * Replaces any character that is not alphanumeric, dash, or underscore with an underscore. */ private keyToPath; /** * Ensure the cache directory exists, creating it recursively if needed. */ private ensureDir; } export {}; //# sourceMappingURL=cache.d.ts.map