- ttl<T, A, K>(run, options?): T & IClearable<K> & IControl<K, ReturnType<T>>
Type Parameters
- T extends ((...args: A) => any)
- A extends any[]
- K = string
Parameters
- run: T
- options: {
key?: ((args: A) => K);
timeout?: number;
} = {}Optional
key?: ((args: A) => K)
Optional
timeout?: number
Returns T & IClearable<K> & IControl<K, ReturnType<T>>
- The wrapped function with caching capability.
Wrap a function with time-to-live (TTL) caching.