import { type AsyncKeyedValueCache, type AsyncValueCache } from './cache'; /** * Wraps an inner {@link AsyncValueCache} with a single-load in-memory memoization layer. * * The first {@link AsyncValueCache.load} call delegates to the inner cache and stores the * result; subsequent calls return the memoized value without touching the inner cache again. * {@link AsyncValueCache.update} writes through to the inner cache and refreshes the memo. * {@link AsyncValueCache.clear} clears both layers. * * Note: the memoized value is per-process. Long-running processes will not observe writes * made by other processes to the inner backing once the memo is populated. * * @param inner - The backing cache to memoize. Reads are delegated once and cached; writes are forwarded through and refresh the memo. * @returns An {@link AsyncValueCache} that proxies the inner cache with a single-load memoization layer. * * @dbxUtil * @dbxUtilCategory cache * @dbxUtilTags memoize, memo, cache, async, single-load, async-value * @dbxUtilRelated memoize-async-keyed-value-cache * * @example * ```ts * const memo = memoizeAsyncValueCache(inMemoryAsyncValueCache('initial')); * await memo.load(); // delegates to inner.load() once * await memo.load(); // returns memoized value without hitting inner * await memo.update('next'); // writes through to inner and refreshes memo * ``` */ export declare function memoizeAsyncValueCache(inner: AsyncValueCache): AsyncValueCache; /** * Wraps an inner {@link AsyncKeyedValueCache} with a single-load in-memory memoization layer * over the full record. * * The first call to any read method ({@link AsyncKeyedValueCache.load} or {@link AsyncKeyedValueCache.get}) * delegates to the inner cache and stores the loaded record; subsequent reads return entries * from the memoized record without re-hitting the inner cache. Writes ({@link AsyncKeyedValueCache.set} / * {@link AsyncKeyedValueCache.remove}) update the memoized record and write through to the inner cache. * {@link AsyncKeyedValueCache.clear} clears both layers. * * Note: the memoized record is per-process. Long-running processes will not observe writes * made by other processes to the inner backing once the memo is populated. * * @param inner - The backing keyed cache to memoize. The full record is loaded once and cached; writes are forwarded through and applied to the memo. * @returns An {@link AsyncKeyedValueCache} that proxies the inner cache with a record-level memoization layer. * * @dbxUtil * @dbxUtilCategory cache * @dbxUtilTags memoize, memo, cache, async, keyed, record * @dbxUtilRelated memoize-async-value-cache * * @example * ```ts * const memo = memoizeAsyncKeyedValueCache(inMemoryAsyncKeyedValueCache({ a: 1 })); * await memo.get('a'); // delegates to inner.load() once * await memo.get('a'); // returns memoized entry without hitting inner * await memo.set('b', 2); // writes through to inner and updates memo * ``` */ export declare function memoizeAsyncKeyedValueCache(inner: AsyncKeyedValueCache): AsyncKeyedValueCache;