Skip to content

Commit 79438c8

Browse files
[Cache] Adds information about smart edge revalidation (#19486)
* Adds information about smart edge revalidation * Apply suggestions from code review Co-authored-by: marciocloudflare <[email protected]> --------- Co-authored-by: marciocloudflare <[email protected]>
1 parent ed075db commit 79438c8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/content/docs/cache/concepts/revalidation.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ pcx_content_type: concept
66

77
import { GlossaryTooltip } from "~/components"
88

9-
Revalidation is a caching mechanism that involves checking the [freshness](/cache/concepts/retention-vs-freshness/) of cached data before serving it to a client or user. If a cached object is no longer [fresh](/cache/concepts/retention-vs-freshness/#freshness-ttl) and Cloudflare receives a request for it, a request is made to the origin to revalidate the object in the Cloudflare cache.
9+
Revalidation is a caching mechanism that checks the [freshness](/cache/concepts/retention-vs-freshness/#freshness-ttl) of cached data before serving it to users. If a cached object is no longer fresh and Cloudflare receives a request for it, the system makes a request to the origin to revalidate the object in the Cloudflare cache. By using headers like `If-Modified-Since` and `ETag`, Cloudflare validates content without fully re-fetching it. When these headers are missing, Smart Edge Revalidation generates a `Last-Modified` header, ensuring efficient updates and delivery of fresh content while reducing origin traffic.
1010

11-
## Example scenarios
11+
## Revalidation towards origin
12+
13+
For stale (expired TTL) content, Cloudflare will send a revalidation request to the origin. If the stale content is still valid Cloudflare will set a new TTL. If the content is expired, then the origin will provide new fresh content to replace the old.
1214

1315
Consider the following example scenarios.
1416

@@ -19,3 +21,7 @@ One-thousand (1,000) requests arrive simultaneously at Cloudflare's network, and
1921
### Example 2
2022

2123
One-thousand (1,000) requests arrive simultaneously at a single Cloudflare data center, and the requested asset is not in Cloudflare's cache (a cache miss). These requests will use a <GlossaryTooltip term="cache lock">cache lock</GlossaryTooltip> to communicate with your origin. This means that only the first request will go to origin to fetch the asset. The remaining 999 requests wait for the first request to fetch the data, after which the response is [streamed](https://blog.cloudflare.com/introducing-concurrent-streaming-acceleration/) to all the waiting requests. The cache lock ensures that Cloudflare only sends the origin one request at a time for a given asset from a location in Cloudflare's network, preventing the origin from getting too much traffic.
24+
25+
## Smart revalidation towards users
26+
27+
When both [`Last-Modified`](https://datatracker.ietf.org/doc/html/rfc7232?cf_history_state=%7B%22guid%22%3A%22C255D9FF78CD46CDA4F76812EA68C350%22%2C%22historyId%22%3A15%2C%22targetId%22%3A%226C8153BAEF7BC0C5A331E28F8BCF1ABA%22%7D#section-2.2) and [`Etag`](https://datatracker.ietf.org/doc/html/rfc7232?cf_history_state=%7B%22guid%22%3A%22C255D9FF78CD46CDA4F76812EA68C350%22%2C%22historyId%22%3A13%2C%22targetId%22%3A%226C8153BAEF7BC0C5A331E28F8BCF1ABA%22%7D#section-2.3) headers are absent from the origin server response, Smart Edge Revalidation will use the time the object was cached on Cloudflare's global network as the `Last-Modified` header value. When a browser sends a revalidation request to Cloudflare using `If-Modified-Since` or `If-None-Match`, our global network can answer those revalidation questions using the `Last-Modified` header generated from Smart Edge Revalidation. In this way, our global network can ensure efficient revalidation even if the headers are not sent from the origin.

0 commit comments

Comments
 (0)