Skip to main content

Function: cachedOr()

cachedOr<C, E, M, I, RD, ND>(nilRunner, transform?): (action) => Promise<RD | ND>

Retrieve an instance from the cache. If the instance is not in cache or if the included relations are not loaded, run the given runner.

Type parameters​

• C extends object

• E extends object

• M extends Model

• I extends any

• RD

• ND = I

Parameters​

• nilRunner: ContextRunner<C & ConsumeCache & ConsumeModel<M>, E, Awaitable<RD>>

• transform?

Returns​

Function

Parameters​

• action: Action<C & ConsumeCache & ConsumeModel<M> & ConsumeInclude & ConsumeId, E>

Returns​

Promise<RD | ND>

Source​

packages/core/src/actions/context/runners/cachedOr.ts:71