import { RouteDataCacheKey } from './cache.mjs'; type FarmClientCacheKey = RouteDataCacheKey; type FarmClientCacheStatus = "idle" | "pending" | "success" | "error"; type FarmClientCacheEntry = { data: TData; updatedAt: number; staleAt: number; gcAt?: number; invalidatedAt?: number; status?: FarmClientCacheStatus; error?: Error | null; fetching?: boolean; /** Marks an entry the persistence layer may write to its adapter. */ persist?: boolean; }; /** @internal Observation seam for the client cache persistence engine. */ type FarmClientCachePersistenceSink = { onSet(key: string, entry: FarmClientCacheEntry): void; onDelete(key: string): void; onClear(): void; }; type FarmClientCacheListener = (event?: "invalidate") => void; declare class FarmClientDataCache { private entries; private aliases; private invalidatedAt; private listeners; private inflight; private unsubscribeInvalidation; private gcTimer; private readonly gcSweepIntervalMs; private persistence; constructor(options?: { subscribeToInvalidation?: boolean; gcSweepIntervalMs?: number | false; }); get size(): number; /** @internal Attach or detach the persistence engine's observation sink. */ attachPersistence(sink: FarmClientCachePersistenceSink | undefined): void; resolveKey(key: string): string; get(key: string, now?: number): FarmClientCacheEntry | undefined; set(key: string, entry: FarmClientCacheEntry): this; delete(key: string): boolean; clear(): void; dispose(): void; isStale(key: string, now?: number): boolean; invalidate(key: string, now?: number): void; alias(alias: string, key: string): void; subscribe(key: string, listener: FarmClientCacheListener): () => void; getInflight(key: string): Promise | undefined; setInflight(key: string, promise: Promise): void; deleteInflight(key: string): void; private scheduleGcSweep; private sweepExpiredEntries; /** * Entry eviction alone leaves the per-key metadata behind. `invalidatedAt` * marks and provisional aliases are created per query invocation, so with * dynamic keys they accumulate for the lifetime of the page even though the * entries they describe are long gone. */ private sweepEntryMetadata; private emit; private notifyListeners; } declare function getFarmClientDataCache(): FarmClientDataCache; declare function normalizeFarmClientCacheKey(key: FarmClientCacheKey): string; export { type FarmClientCacheStatus as F, type FarmClientCacheEntry as a, type FarmClientCacheKey as b, getFarmClientDataCache as g, normalizeFarmClientCacheKey as n };