Update unstable_cache docs for revalidate option (#62689)

Clarifies what passing false or undefined to the revalidate property
option of unstable_cache does.

Context: I didn't want my DB query to be cached at all, but I did use
this API because I wanted to refresh a component's data after submitting
a server action. I thought I had to pass 0, or false to get it to not
cache at all.

Co-authored-by: Sam Ko <sam@vercel.com>
This commit is contained in:
Wes Bos 2024-02-29 14:49:15 -05:00 committed by GitHub
parent 24b7175dcf
commit b1089d3691
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,7 +35,7 @@ const data = unstable_cache(fetchData, keyParts, options)()
- `keyParts`: This is an array that identifies the cached key. It must contain globally unique values that together identify the key of the data being cached. The cache key also includes the arguments passed to the function.
- `options`: This is an object that controls how the cache behaves. It can contain the following properties:
- `tags`: An array of tags that can be used to control cache invalidation.
- `revalidate`: The number of seconds after which the cache should be revalidated.
- `revalidate`: The number of seconds after which the cache should be revalidated. Omit or pass `false` to cache indefinitely or until matching `revalidateTag()` or `revalidatePath()` methods are called.
## Returns