//#region src/node/cache.d.ts /** * Simple background task queue to prevent blocking the main thread during IO. */ declare class BackgroundQueue { private activeTasks; add(task: () => Promise): void; flush(): Promise; get pending(): number; } declare const globalBackgroundQueue: BackgroundQueue; /** * Generic file-based cache with per-file granularity and asynchronous persistence. */ declare class FileCache { private entries; private readonly cachePath; private readonly compress; private loaded; constructor(options?: { name?: string; root?: string; compress?: boolean; }); /** * Loads the cache. */ load(): Promise; /** * Saves the cache in the background. */ save(): void; get(filePath: string): T | null; getStale(filePath: string): T | null; set(filePath: string, data: T): void; isValid(filePath: string): boolean; invalidate(filePath: string): void; invalidateAll(): void; pruneStale(currentFiles: Set): void; get size(): number; flush(): Promise; } /** * Sharded Cache: Optimized for large-scale data (like MDX transformations). * Uses a memory index and individual files for each entry to avoid massive JSON parsing. */ declare class TransformCache { private index; private memoryCache; private readonly baseDir; private readonly shardsDir; private readonly indexPath; private saveTimeout; constructor(name: string, root?: string); /** * Loads the index into memory. */ load(): Promise; /** * Persists the index in background. */ save(): void; /** * Batch Read: Retrieves multiple transformation results concurrently. */ getMany(keys: string[]): Promise>; /** * Retrieves a cached transformation asynchronously. Fast lookup via index, lazy loading from disk. */ getAsync(key: string): Promise; /** * Stores a transformation result. */ set(key: string, result: string): void; get size(): number; flush(): Promise; } /** * Flushes all pending background cache operations. */ declare function flushCache(): Promise; //#endregion export { FileCache, TransformCache, flushCache, globalBackgroundQueue };