Skip to content

Commit

Permalink
docs: fix the signature of CacheHandler#revalidateTag
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Sep 20, 2024
1 parent 9a1cd35 commit 750699a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,13 @@ module.exports = class CacheHandler {
})
}

async revalidateTag(tag) {
async revalidateTag(tags) {
// tags is either a string or an array of strings
tags = [tags].flat()
// Iterate over all entries in the cache
for (let [key, value] of cache) {
// If the value's tags include the specified tag, delete this entry
if (value.tags.includes(tag)) {
if (value.tags.some((tag) => tags.include(tag))) {
cache.delete(key)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ Returns `Promise<void>`.

### `revalidateTag()`

| Parameter | Type | Description |
| --------- | -------- | ---------------------------- |
| `tag` | `string` | The cache tag to revalidate. |
| Parameter | Type | Description |
| --------- | ---------------------- | ----------------------------- |
| `tag` | `string` or `string[]` | The cache tags to revalidate. |

Returns `Promise<void>`. Learn more about [revalidating data](/docs/app/building-your-application/data-fetching/caching-and-revalidating) or the [`revalidateTag()`](/docs/app/api-reference/functions/revalidateTag) function.

Expand Down

0 comments on commit 750699a

Please sign in to comment.