Skip to content

CacheOptions

Defined in: src/cache.ts:93

T

optional coalesce?: boolean

Defined in: src/cache.ts:108

Concurrent misses for the same key share one call (single-flight). Default true.


optional key?: (context) => string | undefined

Defined in: src/cache.ts:96

Cache key for the execution; undefined bypasses the cache. Default: context.operationKey.

ResilienceContext

string | undefined


optional name?: string

Defined in: src/cache.ts:94


optional onCacheHit?: (args) => MaybePromise<void>

Defined in: src/cache.ts:109

OnCacheHitArgs<T>

MaybePromise<void>


optional onCacheMiss?: (args) => MaybePromise<void>

Defined in: src/cache.ts:110

OnCacheMissArgs

MaybePromise<void>


optional onStaleServed?: (args) => MaybePromise<void>

Defined in: src/cache.ts:111

OnStaleServedArgs<T>

MaybePromise<void>


optional shouldCache?: (args) => MaybePromise<boolean>

Defined in: src/cache.ts:102

Default: successful results only. Failures are never cached.

OutcomeArgs<T>

MaybePromise<boolean>


optional shouldServeStale?: ShouldHandle<OutcomeArgs<T>>

Defined in: src/cache.ts:106

Failures a stale value may hide. Default: every failure except aborts and client errors (4xx except 408/429).


optional staleTtl?: Duration

Defined in: src/cache.ts:104

Stale-if-error window after ttl: when the call fails, a value younger than ttl + staleTtl is returned instead. Default 0.


optional store?: CacheStore

Defined in: src/cache.ts:100

Default: a new MemoryCacheStore per strategy. Share one to share the cache between pipelines.


ttl: Duration

Defined in: src/cache.ts:98

How long a value is served without calling. 0 with coalesce gives request deduplication without caching.