WrapOpts
●tagtree · /core·interface
Per-call options for CacheInstance.wrap, extending basic storage controls with a staleness
guard that prevents a late-arriving write from overwriting an invalidation that fired while the
fetcher was in flight.
Properties
PROPTYPEDESCRIPTION
stalenessGuard?
boolean
When ``true``, records the fetch start time and passes it as ``WriteOpts.writeIfNewerThan`` so
any tag invalidation that arrived while the fetcher ran causes the write to be discarded.
swr?
boolean
When ``true``, the adapter may serve a stale entry while revalidating.
ttl?
number
Entry lifetime in seconds; omit for indefinite storage.
Example
const data = await cache.wrap(key, fetcher, { ttl: 60, stalenessGuard: true });Related
ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape
MetadataOpen in GitHub ↗
TenantConfig
Declares how a tenant value maps to a cachekey prefix; the key function serializes the tenant to its string segment, while extraTags injects additional pertenan
WriteOpts
Options that govern how a cache entry is stored; controls TTL expiry, stalewhilerevalidate behavior, and a stalenessguard timestamp that prevents a racing webho