/** * Atlas Frame Caching * * Caches computed Atlas Frames by (module_scope, radius) key to avoid * redundant graph traversals. Tracks cache hits/misses for performance monitoring. */ import type { AtlasFrame } from "./types.js"; /** * Cache statistics for monitoring */ export interface CacheStats { hits: number; misses: number; evictions: number; size: number; } /** * In-memory cache for Atlas Frames * * Uses LRU eviction when cache size exceeds maxSize. * Cache keys are based on sorted module_scope + radius for consistency. */ export declare class AtlasFrameCache { private cache; private accessOrder; private maxSize; private stats; /** * Create a new Atlas Frame cache * * @param maxSize - Maximum number of entries to cache (default: 100) */ constructor(maxSize?: number); /** * Generate cache key from module scope and radius * * Normalizes module_scope by sorting to ensure consistent keys * regardless of input order. */ private getCacheKey; /** * Get cached Atlas Frame if available * * @param moduleScope - Module IDs to look up * @param radius - Fold radius * @returns Cached AtlasFrame or undefined if not found */ get(moduleScope: string[], radius: number): AtlasFrame | undefined; /** * Store Atlas Frame in cache * * @param moduleScope - Module IDs * @param radius - Fold radius * @param frame - Computed Atlas Frame */ set(moduleScope: string[], radius: number, frame: AtlasFrame): void; /** * Update LRU access order */ private updateAccessOrder; /** * Evict least recently used entry */ private evictLRU; /** * Clear all cached entries */ clear(): void; /** * Get cache statistics */ getStats(): CacheStats; /** * Get cache hit rate */ getHitRate(): number; /** * Reset statistics (but keep cached entries) */ resetStats(): void; } /** * Get the global cache instance */ export declare function getCache(): AtlasFrameCache | null; /** * Enable or disable caching globally */ export declare function setEnableCache(enabled: boolean): void; /** * Reset the global cache */ export declare function resetCache(): void; /** * Get global cache statistics */ export declare function getCacheStats(): CacheStats;