/** * Centralized cache helper functions * Provides consistent caching interface across all tools */ import { CacheEngine } from '../core/cache-engine.js'; /** * Get cached content with automatic decompression */ export declare function cacheGet(cache: CacheEngine, key: string): string | null; /** * Reads a compressed JSON value out of the cache, or null. * * AN UNREADABLE CACHE ENTRY IS A MISS, NEVER AN ERROR. * * Several tools stored gzip with `buffer.toString()` -- no encoding, so utf8, * which replaces every invalid byte sequence and cannot be reversed. Measured: * 154 gzip bytes become 263 different ones. The entry was then unreadable for * ever, and because the read path let the exception escape, the tool returned * "incorrect header check" on every subsequent call. Fixing the WRITE was not * enough: existing installations kept the poisoned entry, and nothing ever * replaced it. * * So this decodes base64, and on any failure forgets the entry and reports a * miss, letting the caller recompute and overwrite it. A cache exists to make * a correct answer cheaper; it must never make one impossible. * * @param raw the value already read from the cache (callers usually have it) * @param key the key it came from, so a bad entry can be dropped */ export declare function readCompressedJson(cache: CacheEngine, raw: string | null | undefined, key: string): T | null; /** * Set cached content with automatic compression */ export declare function cacheSet(cache: CacheEngine, key: string, content: string): void; //# sourceMappingURL=cache-helper.d.ts.map