CDN Cache Invalidation 00:00:01 An updated poster still looks old A venue changes its event poster while the edge's old copy is still fresh. Advance the clock to expiry, then follow a conditional request carrying the prior validator. The copy of version 1 may be used for one hour. Version 2 exists. The edge does not know. The hour is over. The copy is stale. The next request makes the edge ask: do you still have etag123? The content changed, so the origin sends 200 with version 2. Unchanged content would be a short 304. Version 2 for the next hour. An unchanged representation can produce a short response confirming reuse. Changed content requires new data, so an explicit validator can reduce bytes without eliminating the validation round trip. 00:00:52 One edge hears the purge late Three edges hold version one after the origin publishes version two. Send a purge and watch the message reach each edge. Can everyone see the change at the same instant? Version 2 is at the origin. Three edges hold version 1. We call the purge service with the path. The message travels to all edges. Edge 3 is slower. For a moment its readers still see version 1. No wrong copy is left at the edges. The next readers wait while each edge fetches version 2. Purge propagation and subsequent refill are separate events. Hard purges can create cold misses and cannot recall copies already held in a browser outside the purge domain. 00:01:36 Keep serving while a refresh runs A product description tolerates a short stale interval. Mark its stored version stale while retaining its bytes and follow the request that initiates a background update. The edge serves version 1. Version 1 is stale from now on, but not removed. Readers get version 1 at once. One request goes to the origin. Version 2 has arrived. Nobody waited. Serve stale only when the content's contract allows it and the cache policy supports it. This approach is unsuitable for providing a current authorization or an exclusive reservation. 00:02:12 Publish a poster with a new name Give each poster revision a different asset URL. The page now chooses the revision in its link. Predict what happens to someone who still has the previous page open. Pages point to v1. It is cached for a year. The new file exists. Nobody asks for it yet. The page now points to v2 and is purged. A reader loads the page and asks for v2: a miss, then a fetch. A reader with an open earlier page still gets v1. New pages get v2. Keep old asset versions available long enough for existing pages. Coordinate the small mutable page with the larger immutable asset to make deployment and rollback predictable. 00:02:55 Invalidate the pages depending on one product One product appears on its detail page, a category page and a promotional page. Tag each response with the item it depends on before changing the price. Every response was stored with its tags. The database is updated and committed. Purge the tag product-123. Three pages are stale and will be refreshed. Product 77 is untouched, although it shares the tag catalog. Commit the source update, then issue an invalidation for the affected dependency. A narrow tag avoids forcing unrelated products and the entire site to refill at once.