Skip to content

Commit adf73d7

Browse files
authored
[cloudflare] add docs for cache interception (#146)
1 parent 485d9b2 commit adf73d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pages/cloudflare/caching.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ The `@opennextjs/cloudflare` caching supports rely on 3 components:
1616
- A **Queue** to synchronize and deduplicate time-based revalidations
1717
- A **Tag Cache** for On-demand revalidations via [`revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag) and [`revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath).
1818

19+
You can also enable cache interception, to avoid calling the `NextServer` and thus loading the javascript associated with the page. It can slightly improve cold start performance for ISR/SSG route on cached routes.
20+
As of now, cache interception does not work with PPR and is not enabled by default.
21+
1922
The adapter provides several implementations for each of those components configured in `open-next.config.ts`.
2023

2124
This guide provides guidelines for common use cases before detailing all the configuration options.
@@ -106,6 +109,8 @@ export default defineCloudflareConfig({
106109
// tagCache: d1NextTagCache,
107110
// filterFn: softTagFilter,
108111
// }),
112+
// Disable this if you want to use PPR
113+
enableCacheInterception: true,
109114
});
110115
```
111116

@@ -181,6 +186,8 @@ export default defineCloudflareConfig({
181186
queue: doQueue,
182187
// This is only required if you use On-demand revalidation
183188
tagCache: doShardedTagCache({ baseShardSize: 12 }),
189+
// Disable this if you want to use PPR
190+
enableCacheInterception: true,
184191
});
185192
```
186193

@@ -200,6 +207,7 @@ import staticAssetsIncrementalCache from "@opennextjs/cloudflare/overrides/incre
200207

201208
export default defineCloudflareConfig({
202209
incrementalCache: staticAssetsIncrementalCache,
210+
enableCacheInterception: true,
203211
});
204212
```
205213

0 commit comments

Comments
 (0)