Why purge exists
TTLs expire content eventually, but sometimes you must remove it now, such as a wrong price or a takedown. Purge and invalidation force the CDN to discard or refresh a cached object before its TTL ends.
Targeting what to clear
- Single object purge clears one exact URL.
- Prefix or wildcard purge clears a path tree at once.
- Tag based purge clears every object stamped with a surrogate tag, useful when one change touches many URLs.
Hard versus soft
- Hard purge deletes the object so the next request is a miss and refill.
- Soft purge marks it stale so the edge can serve it while it revalidates, avoiding a sudden origin spike.
Propagation reality
A purge must reach every PoP, which takes time. Designers prefer versioned URLs, where changing the asset name sidesteps purge entirely. Reserve purge for content whose URL cannot change.
Key idea
Purge removes or refreshes cached content before TTL, by URL, prefix, or tag, while versioned URLs avoid the need to purge at all.