[Workers] Document Workers Caching#30018
Open
danlapid wants to merge 3 commits into
Open
Conversation
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
5 tasks
ff4b423 to
6482d35
Compare
1819b5e to
fe7dc09
Compare
fe7dc09 to
ce681af
Compare
ce681af to
c153be0
Compare
Add docs for Workers Caching — caching HTTP responses from a Worker so that Cloudflare serves them without executing the Worker. New pages under src/content/docs/workers/cache/: - configuration.mdx — enabling caching, Cache-Control semantics, TTL and stale-while-revalidate guidance, cf-cache-status, Cache-Tag - cache-keys.mdx — what the cache key includes, multi-tenant safety with ctx.props, invalidating cache across deployments - purge.mdx — ctx.cache.purge() with tags, pathPrefixes, and purgeEverything; versioned purging with the version metadata binding - debugging.mdx — diagnosing why caching is not behaving as expected - limitations.mdx — unsupported scenarios, limits, relationship to zone cache, the Cache API, and fetch() subrequests index.mdx as a landing page with a quickstart showing wrangler deploy + curl observing HIT/MISS, plus a Durable Object wrapping pattern for caching DO responses. workers/platform/pricing.mdx gets a worked example showing CPU savings with an 80% cache hit rate.
c153be0 to
651ebf1
Compare
Contributor
|
Hey there, we've marked this pull request as stale because there's no recent activity on it. This label helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant). |
* [Workers] Correct and expand Workers Caching docs Round of corrections and additions based on review against pingora-origin and edgeworker cache-handler source. Corrections: - Responses with no Cache-Control are cached by default via RFC 9111 heuristic freshness; the docs previously said the opposite. Add a table of the 10 default-cacheable status codes and their TTLs. - s-maxage, must-revalidate, and proxy-revalidate disable both stale-while-revalidate and stale-if-error, not just s-maxage with SWR. - no-cache caches with zero freshness rather than bypassing. Document the EXPIRED, REVALIDATED, and UPDATING outcomes precisely. - x-forwarded-scheme rule was reworded incorrectly; restored. Additions: - Request collapsing section with the 20s cache lock. - stale-if-error section, including the default (infinite) and the carve-out for s-maxage / must-revalidate / proxy-revalidate. - 520-526 and 206 are never cached, even with explicit Cache-Control. - Cache Deception Armor activation conditions for the heuristic- freshness path. - GET and HEAD share a single cache entry; HEAD on a cold cache is converted to GET internally. - Custom RPC methods and WebSocket upgrades bypass the cache. - Cloudflare-Workers-Version-Key request header is part of the cache key. - Cache-Tag character set (printable ASCII), 1024 chars per tag, 1000 tags per response, case-insensitive purge matching, silent drop of invalid tags. - Standardized the Cf-Cache-Status value list across files. - tags and pathPrefixes can be combined in a single purge() call. - Cf-Cache-Status: STALE debugging section. * [Workers] Style fixes from docs bot review Address style guide warnings from the cloudflare-docs-bot review on PR #31149: - Replace directional words ('table below', 'listed above') with direct references. - Replace 'doesn't' with 'does not'. - Replace 'see [link]' with 'refer to [link]' in newly added text. - Remove 'Note that' filler. - Break a semicolon-joined sentence into two.
Contributor
Review⏸️ Automatic reviews for this PR are paused. This PR has already received 2 automatic reviews. To run another review, a codeowner can comment
|
Contributor
|
CI run failed: build logs |
Contributor
Broken LinksFound 1 broken link(s) across 1 file(s).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add docs for Workers Caching — caching HTTP responses from a Worker so that Cloudflare serves them without executing the Worker.
New pages under src/content/docs/workers/cache/:
index.mdx as a landing page with a quickstart showing wrangler deploy + curl observing HIT/MISS, plus a Durable Object wrapping pattern for caching DO responses.
workers/platform/pricing.mdx gets a worked example showing CPU savings with an 80% cache hit rate.
Summary
Screenshots (optional)
Documentation checklist