> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tuturuuu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Platform-wide CMS delivery cache design

> Shared published-content caching for CMS-backed public sites and responsive editor reads.

## Current evidence and scope

The [CMS site contract](https://docs.tuturuuu.com/platform/features/cms-site-contract-v1.md) defines the shared SDK delivery shape. The renderer Worker in `apps/cms-renderer/src/worker.ts` already keys rendered HTML by site, workspace, locale, path, version and cache epoch. It loads the published page before checking the HTML cache, so a hit still depends on delivery. The web delivery layer also has a short-lived published-payload cache in `apps/web/src/lib/external-projects/delivery-edge-cache.ts`. External CMS apps can consume the contract directly. The platform plan extends the existing caches with a common publication generation and coverage for those consumers. Verify deployed routes and traffic independently of source configuration.

## Delivery phases

1. **Define eligibility at the shared delivery boundary.** Inventory SDK consumers, direct adapters, renderer domains and editor reads. Route every public CMS app through one shared publication contract, including custom domains. Admit only anonymous published GET and HEAD responses with a trusted site binding. Key by site/workspace, canonical host, locale, normalized path/query dimensions, publication generation and schema version. Bound variants and prove parity for redirects, localized paths, pagination and conditional requests. Bypass shared cache for preview, drafts, personalization, authorization, cookies that affect output, private media and responses with Set-Cookie. Editor reads may use session-scoped query caching with permission checks and mutation invalidation.
2. **Make publication invalidate across consumers.** Commit the revision and outbox event together. Advance a monotonic publication pointer for the affected site after the published snapshot is readable. Use immutable revisioned payloads for delivery and HTML. Deduplicate events and ignore older generations. Resolve the small pointer before looking up rendered HTML, avoiding full origin delivery on hits. Treat unpublish, visibility loss and domain reassignment as revocations. Change the generation or deny serving before confirming revocation, ensure old revisions are inaccessible on the public path, and use cross-region purge where needed. A local Cache API deletion only affects one data center. Bound stale serving for ordinary edits and fail closed when revocation state is unavailable. [Cloudflare Cache API](https://developers.cloudflare.com/workers/runtime-apis/cache/)
3. **Canary and expand.** Start with fixture sites and a representative external app, then expand by site cohort. Compare authenticated editor reads and anonymous cold/warm delivery against the uncached baseline. Agree on latency, hit rate, origin request, publication freshness and revocation targets before pilot. Record p50/p95 by app and region and prove warm hits avoid full origin reads. Require a coverage matrix across all external CMS apps before declaring completion.

## Acceptance, rollback and spend

Test identical paths across tenants and domains, locale and query variants, missed or reordered publication events, cache eviction, unpublish across regions, preview isolation and stale permission changes. Confirm editor read-your-writes and public fallback eligibility. Use synthetic content and keep private previews, request credentials and author data out of shared caches and telemetry.

Reserve per-site and global budgets for origin reads, render misses, cache writes, purge operations and queue deliveries. Coalesce concurrent misses and bound prewarm fan-out, variant cardinality and retry attempts. Use durable site and global stop generations checked before enqueue, retry and chargeable work. A stopped generation serves only still-eligible cached content or uses a separately metered, verified uncached path. Deny on exhaustion or unknown publication visibility. Roll back per cohort to the verified prior serving path, with a new cache namespace and revocation enforcement. Prove under queue replay, restart and origin failure that operation counts stay within the admitted budget.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.