Skip to content

Commit 14ed8ee

Browse files
authored
Updating no-cache changelog for clarity (#24278)
1 parent 644fa2d commit 14ed8ee

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Requests made from Cloudflare Workers can now force a revalidation of their cache with the origin.
2+
title: Requests made from Cloudflare Workers can now force a revalidation of their cache with the origin
33
description: New runtime APIs allow you to control when subrequests revalidate cache, increasing compatibility with popular NPM packages
44
products:
55
- workers
66
date: 2025-08-07
77
---
88

9-
import { Render, PackageManagers, TypeScriptExample } from "~/components"
9+
import { Render, PackageManagers, TypeScriptExample } from "~/components";
1010

1111
By setting the value of the `cache` property to `no-cache`, you can force [Cloudflare's
12-
cache](/workers/reference/how-the-cache-works/) to revalidate, its contents with the origin when
12+
cache](/workers/reference/how-the-cache-works/) to revalidate its contents with the origin when
1313
making subrequests from [Cloudflare Workers](/workers).
1414

1515
<TypeScriptExample filename="index.ts">
@@ -24,14 +24,17 @@ export default {
2424
```
2525
</TypeScriptExample>
2626

27-
When you set the value to `no-cache` on a subrequest made from a Worker, the Cloudflare Workers
28-
runtime will force the cache to revalidate its data with the origin
27+
When `no-cache` is set, the Worker request will first look for a match in Cloudflare's cache, then:
28+
29+
- If there is a match, a conditional request is sent to the origin, regardless of whether or not the match is fresh or stale. If the resource has not changed, the
30+
cached version is returned. If the resource has changed, it will be downloaded from the origin, updated in the cache, and returned.
31+
- If there is no match, Workers will make a standard request to the origin and cache the response.
2932

3033
This increases compatibility with NPM packages and JavaScript frameworks that rely on setting the
3134
[`cache`](/workers/runtime-apis/request/#options) property, which is a cross-platform standard part
3235
of the [`Request`](/workers/runtime-apis/request/) interface. Previously, if you set the `cache`
3336
property on `Request` to `'no-cache'`, the Workers runtime threw an exception.
3437

35-
* Learn [how the Cache works with Cloudflare Workers](/workers/reference/how-the-cache-works/)
36-
* Enable [Node.js compatibility](/workers/runtime-apis/nodejs/) for your Cloudflare Worker
37-
* Explore [Runtime APIs](/workers/runtime-apis/) and [Bindings](/workers/runtime-apis/bindings/) available in Cloudflare Workers
38+
- Learn [how the Cache works with Cloudflare Workers](/workers/reference/how-the-cache-works/)
39+
- Enable [Node.js compatibility](/workers/runtime-apis/nodejs/) for your Cloudflare Worker
40+
- Explore [Runtime APIs](/workers/runtime-apis/) and [Bindings](/workers/runtime-apis/bindings/) available in Cloudflare Workers

src/content/compatibility-flags/cache-no-cache.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ When `no-cache` is specified:
2020
- All requests have the headers `Pragma: no-cache` and `Cache-Control: no-cache` are set on them.
2121

2222
- Subrequests to origins not hosted by Cloudflare force Cloudflare's cache to revalidate with the
23-
origin.
23+
origin.
24+
25+
Revalidating with the origin means that the Worker request will first look for a match in Cloudflare's cache, then:
26+
27+
- If there is a match, a conditional request is sent to the origin, regardless of whether or not the match is fresh or stale. If the resource has not changed, the
28+
cached version is returned. If the resource has changed, it will be downloaded from the origin, updated in the cache, and returned.
29+
- If there is no match, Workers will make a standard request to the origin and cache the response.
2430

2531
Examples using `cache: 'no-cache'`:
2632

@@ -33,4 +39,4 @@ The cache value can also be set on a `Request` object.
3339
```js
3440
const request = new Request("https://example.com", { cache: "no-cache" });
3541
const response = await fetch(request);
36-
```
42+
```

0 commit comments

Comments
 (0)