revalidateTag
API Reference for the revalidateTag function.
revalidateTag
allows you to purge cached data on-demand for a specific cache tag.
Good to know:
revalidateTag
is available in both Node.js and Edge runtimes.revalidateTag
only invalidates the cache when the path is next visited. This means callingrevalidateTag
with a dynamic route segment will not immediately trigger many revalidations at once. The invalidation only happens when the path is next visited.
Parameters
tag
: A string representing the cache tag associated with the data you want to revalidate. Must be less than or equal to 256 characters. This value is case-sensitive.
You can add tags to fetch
as follows:
Returns
revalidateTag
does not return a value.