
Cache invalidation removes cached content from Cloud CDN edge caches before it expires. You run it against the URL map of the load balancer, for a specific path or for a path pattern, and after it finishes, the next request for each matching object misses the cache and is fetched from the origin. Invalidation is the tool for getting rid of copies that are already at the edge. It does not change what is stored at the origin, so it is usually paired with a fix there. For the Professional Cloud Network Engineer exam, the topic comes down to knowing how invalidation is scoped, what order the steps go in, and how it relates to cache expiry and Cache-Control.
An invalidation runs against the load balancer's URL map. You can name a single path, or a path pattern that ends in a wildcard. A wildcard pattern clears every object under that prefix with one invalidation, while objects under other prefixes stay cached.
Invalidation is not instant. It takes a few minutes to propagate across the edge caches. Once it completes, the next request for each invalidated object is a cache miss, and Cloud CDN fetches the object from the origin again.
Cached copies are stored under the URL that clients request, so replacing stale content means putting the correct file at that same path. The work happens in two steps:
Overwriting first means the origin already holds the correct file when the next request misses the cache. A file published under a new object name has a new URL of its own, and nothing set on it reaches the copy already cached at the old path.
An invalidation is the way to remove cached copies early. Without one, copies can stay at the edge until their TTL expires. Turning Cloud CDN off and back on is not a purge, so edge caches can keep serving old copies until their TTL expires, and it also disrupts caching for objects that should stay cached. Changes on the Cloud Storage side, such as lifecycle rules or access settings, act on the stored objects and on who can read them rather than on the copies held at the edge.
Invalidation clears what is cached at one point in time, but it does not stop later responses from being cached again. Keeping a file out of the cache going forward is the job of the Cache-Control header. In the default cache mode, Cloud CDN does not store responses marked Cache-Control: private, and with a Cloud Storage origin the header has to be set on every upload, because each upload creates a new object with its own metadata. The header governs new responses, and an invalidation clears the copies that are already at the edge.
For Professional Cloud Network Engineer scenarios about stale content, we would fix the origin first, invalidate the exact path or prefix that is stale, and use Cache-Control when a file should not be cached at all.
Our Professional Cloud Network Engineer practice exams cover Cloud CDN cache invalidation alongside cache modes and cache keys, with detailed explanations that drill these distinctions.