Surrogate key / cache tag
A label shared by related cached pages, so one purge can clear every page showing the same product, post, or category.
See it
What it is
A surrogate key, also called a cache tag, is a label attached to a cached response. A product page, category page, and home page can all carry 'product-42'. When that product changes, one purge for the label invalidates every cached page that contains it, even though the pages have different URLs.
Reach for tags when one piece of data appears across many routes and a URL-by-URL purge list would be fragile. Fastly uses the Surrogate-Key response header and popularized the pattern; Cloudflare's equivalent is the Cache-Tag header, which is an Enterprise-plan feature, so check your plan before designing around it. This is a provider feature, not a standard browsers understand.
Gotcha: a tag is only useful if every affected response receives it. Missing the tag on a listing page leaves that page stale, while tags that are too broad turn a precise purge into a small purge-everything. Keep keys stable, attach both entity and collection keys where needed, and log the exact keys sent to the purge API.
Ask AI for it
Implement Fastly surrogate-key invalidation for this app. Add a 'Surrogate-Key' response header containing stable entity and collection keys such as 'product-42' and 'category-shoes'. After a publish or update, call Fastly's Purge API once per affected key and send 'Fastly-Soft-Purge: 1' so stale content remains available during refill. Never purge all. Log the entity id, emitted keys, purge response status, and retry failures with exponential backoff.