Invalidating methods
There are two methods for invalidating content: PURGE, which is a single invalidation that invalidates one particular object; and BAN, which is a recursive invalidation that can invalidate more than one object at a time.
Cache Key
A cache key is how the CDN saves an object to its cache. By default, the cache key is made up of:
[Host header] + [url] + [Query Stream]From there, we can complicate the cache key as much as we wish, adding more elements to save more versions of the same object. Let’s look at an example:
https://www.transparentcdn.com/index.html?param=1
https://www.transparentcdn.com/index.html?param=2For Transparent Edge—and in general for any other system of HTTP caches—these are distinct objects. Therefore, even if the first one is cached, it will download again to the origin when the second one is requested.
We can use the Vary header to modify the behavior and save more versions of the same object. For instance, with an object like this:
https://www.transparentcdn.com/index.html?param=1And a Vary header like this:
Vary: User-AgentWe can make the CDN cache save as many objects as the number of user-agents requesting them.
Single or PURGE invalidations
This kind of invalidation lets you invalidate one particular object in the cache. To do so, you must be sure to enter the full URL with all the parameters included.
One type of PURGE invalidation is known as a SOFTPURGE, which is much less aggressive.
To do an invalidation from our dashboard, just follow this guide.
Recursive or BAN invalidations
BAN invalidations let you invalidate cache content recursively, by sending a blacklist and telling the cache to invalidate any object that matches it. For instance, we can tell it to invalidate https://www.transparentedge.eu/images/. This would invalidate any object that matches this URL, such as:
https://www.transparentedge.eu/images/image1.png or https://www.transparentedge.eu/images/2020/02/22/index.php.
To do an invalidation from our dashboard, just follow this guide.
Last updated
Was this helpful?
