Unverified Commit eb53f795 authored by Sam Ko's avatar Sam Ko Committed by GitHub

docs(use-cache): add invalidating section to use cache docs (#76958)

## Why?

The cacheTag mention [here](https://nextjs.org/docs/app/api-reference/directives/use-cache#revalidating) makes it seem like cacheTag does the "revalidating," but actually this is still revalidateTag's job.

- Related: https://github.com/vercel/next.js/issues/76581
parent 13670aea
...@@ -201,12 +201,18 @@ By default, Next.js sets a **[revalidation period](/docs/app/building-your-appli ...@@ -201,12 +201,18 @@ By default, Next.js sets a **[revalidation period](/docs/app/building-your-appli
While this revalidation period may be useful for content you don't expect to change often, you can use the `cacheLife` and `cacheTag` APIs to configure the cache behavior: While this revalidation period may be useful for content you don't expect to change often, you can use the `cacheLife` and `cacheTag` APIs to configure the cache behavior:
- [`cacheLife`](/docs/app/api-reference/functions/cacheLife): For time-based revalidation periods. - [`cacheLife`](/docs/app/api-reference/functions/cacheLife): For time-based revalidation periods.
- [`cacheTag`](/docs/app/api-reference/functions/cacheTag): For on-demand revalidation. - [`cacheTag`](/docs/app/api-reference/functions/cacheTag): For tagging cached data.
Both of these APIs integrate across the client and server caching layers, meaning you can configure your caching semantics in one place and have them apply everywhere. Both of these APIs integrate across the client and server caching layers, meaning you can configure your caching semantics in one place and have them apply everywhere.
See the [`cacheLife`](/docs/app/api-reference/functions/cacheLife) and [`cacheTag`](/docs/app/api-reference/functions/cacheTag) docs for more information. See the [`cacheLife`](/docs/app/api-reference/functions/cacheLife) and [`cacheTag`](/docs/app/api-reference/functions/cacheTag) docs for more information.
### Invalidating
To invalidate the cached data, you can use the [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag) function.
See the [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag) docs for more information.
### Interleaving ### Interleaving
If you need to pass non-serializable arguments to a cacheable function, you can pass them as `children`. This means the `children` reference can change without affecting the cache entry. If you need to pass non-serializable arguments to a cacheable function, you can pass them as `children`. This means the `children` reference can change without affecting the cache entry.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment