[]previous and next page

CacheStrategy

How a runtime rule answers a request.

How a runtime rule answers a request.

  • network-first: ask the network, keep the answer, and fall back to the kept one when the network fails or is slower than networkTimeoutSeconds.
  • cache-first: answer from the cache, and ask the network only on a miss (or when the kept answer is older than maxAgeSeconds).
  • stale-while-revalidate: answer from the cache at once and refresh it in the background.

Import#

ts
import type { CacheStrategy } from "@shadow-js/dusk/vite";

Signature#

ts
type CacheStrategy = "network-first" | "cache-first" | "stale-while-revalidate"