/** * @file `memoize` — synchronous function memoizer with LRU eviction (Map * insertion-order based), optional TTL, and optional custom key generator. * Each instance registers itself with the shared `cacheRegistry` so * `clearAllMemoizationCaches` can sweep it. */ import type { MemoizeOptions } from './types.js'; /** * Memoize a function with configurable caching behavior. Caches function * results to avoid repeated computation. * * @example * import { memoize } from '@socketsecurity/lib/memo/memoize' * * const expensiveOperation = memoize( * (n: number) => { * // Heavy computation * return Array(n) * .fill(0) * .reduce((a, _, i) => a + i, 0) * }, * { maxSize: 100, ttl: 60000, name: 'sum' }, * ) * * expensiveOperation(1000) // Computed * expensiveOperation(1000) // Cached * * @param fn - Function to memoize. * @param options - Memoization options. * * @returns Memoized version of the function */ export declare function memoize(fn: (...args: Args) => Result, options?: MemoizeOptions | undefined): (...args: Args) => Result;