You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,7 @@ Welcome to [**`@neshca/cache-handler`**](./packages/cache-handler/README.md), a
8
8
9
9
### Next.js Routers support
10
10
11
-
- Full support for Pages Router.
12
-
- Almost full support for App Router. The only exception is the [`revalidatePath`](https://github.com/caching-tools/next-shared-cache/issues/382) function.
11
+
- Full support for the Pages and the App Router.
13
12
14
13
### The importance of shared cache in distributed environments
Copy file name to clipboardExpand all lines: docs/cache-handler-docs/src/pages/index.mdx
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,7 @@ Welcome to `@neshca/cache-handler`, a specialized ISR/Data cache API crafted for
2
2
3
3
### Next.js Routers support
4
4
5
-
- Full support for Pages Router.
6
-
- Almost full support for App Router. The only exception is the [`revalidatePath`](https://github.com/caching-tools/next-shared-cache/issues/382) function.
5
+
- Full support for the Pages and the App Router.
7
6
8
7
### The importance of shared cache in distributed environments
Copy file name to clipboardExpand all lines: docs/cache-handler-docs/src/pages/usage/on-demand-revalidation.mdx
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,22 @@ Next.js provides a way to revalidate a page or a result of a `fetch` call on dem
6
6
7
7
### Pages Router
8
8
9
-
The Pages Router supports only the `revalidatePath` option.
9
+
The Pages Router supports only the `response.revalidate(path)`.
10
10
11
11
See [Using On-Demand Revalidation](https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration#using-on-demand-revalidation) in the Next.js documentation.
12
12
13
+
#### `response.revalidate(path)` caveat
14
+
15
+
Calling `response.revalidate(path)` will synchronously call `getStaticProps` and render the page with a given `path`. Then it will revalidate the cache for this page. If you want to revalidate multiple paths at once, you need to call `response.revalidate(path)` multiple times.
16
+
13
17
### App Router
14
18
15
-
The App Router supports both `revalidatePath` and `revalidateTag` functions. However due to current limitations, `revalidatePath` is disabled for the App Router.
19
+
The App Router supports both `revalidatePath` and `revalidateTag` functions. These functions will remove the cache values from the store.
16
20
17
21
See [On-demand Revalidation](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#on-demand-revalidation) in the Next.js documentation.
22
+
23
+
#### `revalidatePath` caveat
24
+
25
+
The `revalidatePath` function works differently from the `response.revalidate(path)` and `revalidateTag` functions. It does not revalidate the cached `fetch` result immediately. Instead, it marks the cache as revalidated and the next request will revalidate the cache.
26
+
27
+
If you are creating a custom cache Handler, you need to manually mark the cache as revalidated in Handler's `revalidateTag` method. Later in the Handler's `get` method, you must check if the cache is revalidated and return `null` if necessary. See [Custom Redis strings example](/usage/creating-a-custom-handler#guide)
0 commit comments