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