# Cache invalidation

Publish once, refresh dependent pages

Published references have their own cache tag. The publish webhook expires that tag so dependent pages read the latest published notes. Draft preview bypasses the cache.

## Expire reference consumers

The webhook expires the reference cache separately from individual story caches. Pages without related content keep their cached story data.

```typescript
  // Reference consumers have a separate dependency tag, not a global page flush.
  revalidateTag(relatedContentCacheTag, expireNow);
```

Expire immediately after a valid publish event.

[src/app/api/revalidate/route.ts](https://github.com/marcop135/nextstory/blob/main/src/app/api/revalidate/route.ts)

Canonical: https://nextstory.marcopontili.com/cache-invalidation
Content source: storyblok; published representation.
