Skip to content

Documentation / @ripl/utilities / CachedFunction

Type Alias: CachedFunction()<TValue>

CachedFunction<TValue> = ReturnType<TValue>

Defined in: packages/utilities/src/function.ts:10

A function wrapper that caches its result after the first invocation until explicitly invalidated.

Type Parameters

Type Parameter
TValue extends AnyFunction

CachedFunction(...args): ReturnType<TValue>

A function wrapper that caches its result after the first invocation until explicitly invalidated.

Parameters

ParameterType
...argsParameters<TValue>

Returns

ReturnType<TValue>

Methods

invalidate()

invalidate(): void

Defined in: packages/utilities/src/function.ts:13

Clears the cached result so the next call recomputes it.

Returns

void