MCPcopy Create free account
hub / github.com/SuperteamDAO/earn / CacheControlOptions

Interface CacheControlOptions

src/utils/cacheControl.ts:17–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17interface CacheControlOptions {
18 // Cacheability
19 public?: boolean; // Allow caching in both browsers and CDNs
20 private?: boolean; // Allow caching only in browsers, not CDNs
21
22 // No caching
23 noCache?: boolean; // Cache exists but verifies with server every time
24 noStore?: boolean; // Don't cache at all, fetch fresh every time
25
26 // Freshness (in seconds)
27 maxAge?: number; // How long browsers should keep cache without checking server
28 sMaxAge?: number; // How long CDNs should keep cache without checking server
29
30 // Stale content handling (in seconds)
31 staleWhileRevalidate?: number; // Show old cache while fetching new data in background
32 staleIfError?: number; // Show old cache if server fails to respond
33
34 // Revalidation
35 mustRevalidate?: boolean; // Force check with server when cache expires (both cdn and browser)
36 proxyRevalidate?: boolean; // Force only CDNs to check with server when cache expires
37
38 // Other directives
39 immutable?: boolean; // Content won't change while cache is valid
40 noTransform?: boolean; // Don't allow CDNs to modify the response
41}
42
43export function setCacheHeaders(
44 res: NextApiResponse,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected