Skip to content

Commit 0350e00

Browse files
docs: document cache tagging mechanism (#53806)
This PR document the cache tagging semantics in Next.js, and how to benefit from it during cache revalidation.
1 parent 5fe3321 commit 0350e00

File tree

1 file changed

+8
-0
lines changed
  • docs/02-app/02-api-reference/04-functions

1 file changed

+8
-0
lines changed

docs/02-app/02-api-reference/04-functions/fetch.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ Set the cache lifetime of a resource (in seconds).
9494
> - As a convenience, it is not necessary to set the `cache` option if `revalidate` is set to a number since `0` implies `cache: 'no-store'` and a positive value implies `cache: 'force-cache'`.
9595
> - Conflicting options such as `{ revalidate: 0, cache: 'force-cache' }` or `{ revalidate: 10, cache: 'no-store' }` will cause an error.
9696
97+
### `options.next.tags`
98+
99+
```ts
100+
fetch(`https://...`, { next: { tags: ['collection'] } })
101+
```
102+
103+
Set the cache tags of a resource. Data can then be revalidated on-demand using [`revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag).
104+
97105
## Version History
98106

99107
| Version | Changes |

0 commit comments

Comments
 (0)