import { type AsyncKeyedValueCache, type AsyncValueCache } from './cache'; /** * Composes multiple {@link AsyncValueCache} instances into a single read-from-first-write-to-all cache. * * - {@link AsyncValueCache.load} returns the first non-null/undefined value from the input caches in order. * - {@link AsyncValueCache.update} writes the value to every input cache, propagating from the * lowest-precedence (slowest, source-of-truth) tier up to the highest-precedence (fastest) tier * so a failed write to the backing store is not masked by a successful write to memory. * - {@link AsyncValueCache.clear} clears every input cache in the same lower-to-higher order. * * Useful for memory-then-disk layering or for combining a fast tier with a slow source-of-truth tier. * * @param caches - Ordered tiers from highest-precedence (fastest, e.g. memory) to lowest-precedence (source-of-truth, e.g. disk). Reads honor this order; writes propagate in reverse. * @returns A single {@link AsyncValueCache} layered across the provided tiers. * * @example * ```ts * const layered = mergeAsyncValueCaches([ * inMemoryAsyncValueCache(), * diskBackedAsyncValueCache() * ]); * await layered.update('hello'); // writes to disk first, then memory * await layered.load(); // returns from memory if present * ``` */ export declare function mergeAsyncValueCaches(caches: ReadonlyArray>): AsyncValueCache; /** * Composes multiple {@link AsyncKeyedValueCache} instances into a single read-from-first-write-to-all cache. * * - {@link AsyncKeyedValueCache.get} returns the first non-null/undefined value from the input caches in order for a given key. * - {@link AsyncKeyedValueCache.load} returns a merged record where earlier caches' entries take precedence over later caches'. * - Writes ({@link AsyncKeyedValueCache.set} / {@link AsyncKeyedValueCache.remove}) propagate to every input cache. * - {@link AsyncKeyedValueCache.clear} clears every input cache. * * @param caches - Ordered tiers from highest-precedence (fastest, e.g. memory) to lowest-precedence (source-of-truth, e.g. disk). Reads honor this order; writes propagate in reverse. * @returns A single {@link AsyncKeyedValueCache} layered across the provided tiers. * * @example * ```ts * const layered = mergeAsyncKeyedValueCaches([ * inMemoryAsyncKeyedValueCache(), * diskBackedAsyncKeyedValueCache() * ]); * await layered.set('a', 1); // writes to disk first, then memory * await layered.get('a'); // returns from memory if present * ``` */ export declare function mergeAsyncKeyedValueCaches(caches: ReadonlyArray>): AsyncKeyedValueCache;