Skip to Content
ReferencePublishingCache policy

Cache policy

Audience: CMS editors and developers.

This reference describes application defaults and cache invalidation. Deployment settings and endpoint-specific headers can change the effective HTTP policy. Cache durations and worker schedules are not end-to-end publishing deadlines.

Database cache

The CMS reuses matching Prisma reads within a GraphQL query request. It separates entries by access context and stops reuse after writes, raw SQL, transactions, or response completion. This request scope does not retain database query results between requests.

CMS responses

The CMS Apollo server configures a 100 MiB internal LRU cache with a five-minute default TTL. Persisted-query metadata has separate TTL settings. These internal settings do not establish a five-minute lifetime for every GraphQL response. Request-scoped Prisma read reuse is a separate mechanism.

Backend requests and responses

The backend CMS client uses Apollo InMemoryCache for normalized data. Query fetch policies, explicit eviction, client replacement, and network refresh control reuse. The client has no general time-based expiry for CMS results.

Backend feature caching uses process memory by default. APP_CACHE_MODE=valkey selects Valkey and requires VALKEY_URL. Nest request caching is registered only in Valkey mode and applies to selected endpoints. HTTP response headers and service cache lifetimes are separate settings.

The recurring page warmup job uses a six-hour schedule. It requires enabled warmup, ready project configuration, and at least one hour of uptime. This schedule controls warmup work, not response lifetimes.

Revalidation scope

The page worker evicts cached page data and referenced banners, reloads the backend page, and requests frontend regeneration. Ordinary page eviction retains referenced header, footer, and theme entities.

Header and footer notifications purge the relevant structure cache and queue affected pages. Updates to existing header menu items and footer sections also notify their parent structure. Theme notifications evict and refresh theme data.

Explicit path requests normally use the highest priority and start a network refresh of supporting structures. Product-page requests use the lowest priority and cache-first structure reads. A page refresh therefore does not always retain unchanged cached header and footer data.

Queue behavior

The worker runs every five seconds after project configuration is ready. It selects tasks that are at least ten seconds old and available for processing. It orders eligible tasks by descending priority, then ascending creation time.

The worker reloads backend page data before it requests frontend regeneration. Queue load, page complexity, failures, and retries affect completion time. The worker has no fixed completion time.

Browser cache

These defaults apply to public page cache configuration:

SettingDefaultPurpose
NEXT_PUBLIC_MAX_AGE0 secondsBrowser max-age
NEXT_PUBLIC_SMA60 secondsShared-cache s-maxage and timed ISR interval
NEXT_PUBLIC_SWR60 secondsShared-cache stale-while-revalidate window
NEXT_PUBLIC_EDGE_MAX_AGE60 secondsCDN override max-age
NEXT_PUBLIC_EDGE_SWR10 secondsCDN override stale-while-revalidate window

The frontend emits Cache-Control, CDN-Cache-Control, and Cloudflare-CDN-Cache-Control headers. Route-specific policies can differ. Actual CDN caching depends on deployment and provider configuration.

Timed ISR uses NEXT_PUBLIC_SMA when enabled and cache settings are valid. NEXT_PUBLIC_ISR_REVALIDATION_ENABLED=0 selects on-demand-only ISR without changing HTTP cache headers. A zero shared-cache interval or invalid cache value also disables timed ISR. These frontend values are build inputs.

Use refresh content to request an update and inspect the result.

Last updated on