Invalidate by tag from the code that changed the data
With time-based revalidation, data can be stale for up to the whole interval. With tags, the cache is fresh the moment the write happens.
// when caching
cacheTag(`post:${slug}`);
// in the server action that edits the post
revalidateTag(`post:${slug}`);Name tags after the entity and its id. A mutation knows exactly which entity it touched, so it knows exactly which tags to clear.
nextjscaching