WriteOpts

tagtree · /core·interface

Options that govern how a cache entry is stored; controls TTL expiry, stale-while-revalidate behavior, and a staleness-guard timestamp that prevents a racing webhook from being overwritten by a fetch that started before the invalidation arrived.

Properties

swr?
boolean
When ``true``, the adapter may return a stale entry and revalidate in the background.
ttl?
number
Entry lifetime in seconds; omit for indefinite storage.
writeIfNewerThan?
number
Reject the write if any of the entry's tags were invalidated after this epoch timestamp.

Example

await instance.write(key, data, { ttl: 300, swr: true });

ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape

Sourceadapter.ts:57Edit the JSDoc directly

On this page