Cache configuration
Look up a cached response.
An object with entry (the cached CacheEntry) and stale (boolean indicating
the entry is expired but within the stale-while-revalidate or stale-if-error window),
or null if no matching entry was found.
Store a response in the cache.
The request used as the cache key
The response to cache
Optional tags, per-entry TTL override, or force flag to bypass no-store
true if the entry was stored, false if rejected (uncacheable, too large, or quota exceeded)
Build conditional request headers (If-None-Match / If-Modified-Since) for cache revalidation.
Handle a 304 Not Modified response — refresh the entry TTL in place.
Mark a request as being revalidated for stale-while-revalidate. Returns false if the key is already in flight.
Clear the SWR in-flight flag for a request.
Check whether a request is currently being revalidated.
Delete a single entry from the cache.
true if the entry existed and was deleted
Delete all entries whose URLs start with a given prefix. Works with namespaces.
Delete all entries with a specific tag.
Clear all cached entries.
Get a snapshot of current cache statistics.
Reset all cache statistics to zero.
Serialize cache entries to a JSON string for persistence. Expired entries are excluded. Format: { version: 1, entries: [[key, entry], ...] }.
RFC 7234-compliant HTTP cache with LRU eviction, Vary support, stale-while-revalidate, stale-if-error, tag-based invalidation, and pluggable storage backends.
Example