import { LruCache, LruCacheStats } from './lru-cache.js'; /** * Wrap an async function with an LRU cache so repeated calls with the * same arguments are served from memory — addresses issue #125's * "store results of expensive operations" for smart_read, smart_grep, * smart_glob, and edit-correction paths. * * Each wrapped function owns its own cache, but every cache is * registered with the shared `memoRegistry` so the server can prune * and log stats for all of them at once. */ export interface LruMemoizeOptions { /** Identifier used in logs. */ name: string; /** Max cached entries. */ maxSize: number; /** Default per-entry TTL in ms. 0 disables expiration. */ ttlMs?: number; /** Custom key function; defaults to sha256(JSON.stringify(args)). */ keyFn?: (args: Args) => string; } export interface RegisteredCache { name: string; cache: LruCache; /** * Invalidation hook: clears stored entries AND fences off in-flight * calls so a result computed before invalidation can never be written * back into the cache afterwards. */ invalidate: () => void; } declare class MemoRegistry { private readonly caches; register(entry: RegisteredCache): void; /** Prune every registered cache and return total entries removed. */ pruneAll(): number; stats(): Record; clearAll(): void; } export declare const memoRegistry: MemoRegistry; export declare function lruMemoize(fn: (...args: Args) => Promise, options: LruMemoizeOptions): (...args: Args) => Promise; export {}; //# sourceMappingURL=lru-memoize.d.ts.map