fast-typescript-memoize
Version:
Fast memoization decorator and other helpers with 1st class support for Promises.
13 lines • 612 B
TypeScript
/**
* Similar to lodash.memoize(), but auto-expires the cached results after the
* provided number of inactive milliseconds. Each time we read a cached result,
* the expiration timer resets.
*
* This function is more expensive than lodash.memoize(), because it uses a JS
* timer under the hood.
*/
export declare function memoizeExpireUnused<TThis, TArgs extends unknown[], TResult>(func: (this: TThis, ...args: TArgs) => TResult, { resolver, unusedMs, }?: {
resolver?: (this: TThis, ...args: TArgs) => unknown;
unusedMs?: number;
}): typeof func;
//# sourceMappingURL=memoizeExpireUnused.d.ts.map