From 03603efafc537b894a5cc4c0815e7b7f2272208d Mon Sep 17 00:00:00 2001 From: conico974 Date: Tue, 6 May 2025 12:25:14 +0200 Subject: [PATCH 1/2] add docs for cache interception --- pages/cloudflare/caching.mdx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pages/cloudflare/caching.mdx b/pages/cloudflare/caching.mdx index b2f127b..149ca81 100644 --- a/pages/cloudflare/caching.mdx +++ b/pages/cloudflare/caching.mdx @@ -16,6 +16,9 @@ The `@opennextjs/cloudflare` caching supports rely on 3 components: - A **Queue** to synchronize and deduplicate time-based revalidations - 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). +You can also enable `cache interception`, which allows to avoid calling `NextServer` and thus loading the javascript associated with the page. It can slightly improve cold start performance for ISR/SSG route. +As of now, cache interception does not work with PPR and is not enabled by default. + The adapter provides several implementations for each of those components configured in `open-next.config.ts`. This guide provides guidelines for common use cases before detailing all the configuration options. @@ -106,6 +109,8 @@ export default defineCloudflareConfig({ // tagCache: d1NextTagCache, // filterFn: softTagFilter, // }), + // Disable this if you want to use PPR + enableCacheInterception: true, }); ``` @@ -181,6 +186,8 @@ export default defineCloudflareConfig({ queue: doQueue, // This is only required if you use On-demand revalidation tagCache: doShardedTagCache({ baseShardSize: 12 }), + // Disable this if you want to use PPR + enableCacheInterception: true, }); ``` @@ -200,6 +207,7 @@ import staticAssetsIncrementalCache from "@opennextjs/cloudflare/overrides/incre export default defineCloudflareConfig({ incrementalCache: staticAssetsIncrementalCache, + enableCacheInterception: true, }); ``` From 81d1b3efcac0852d0e9323d5ae3e191100bb5870 Mon Sep 17 00:00:00 2001 From: conico974 Date: Tue, 6 May 2025 14:06:26 +0200 Subject: [PATCH 2/2] Update pages/cloudflare/caching.mdx Co-authored-by: Victor Berchet --- pages/cloudflare/caching.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/cloudflare/caching.mdx b/pages/cloudflare/caching.mdx index 149ca81..6ffd02c 100644 --- a/pages/cloudflare/caching.mdx +++ b/pages/cloudflare/caching.mdx @@ -16,7 +16,7 @@ The `@opennextjs/cloudflare` caching supports rely on 3 components: - A **Queue** to synchronize and deduplicate time-based revalidations - 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). -You can also enable `cache interception`, which allows to avoid calling `NextServer` and thus loading the javascript associated with the page. It can slightly improve cold start performance for ISR/SSG route. +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. As of now, cache interception does not work with PPR and is not enabled by default. The adapter provides several implementations for each of those components configured in `open-next.config.ts`.