Purge cached content
Remove a cached object before its TTL ends, by URL, by cache key, or by wildcard, from Azion Console, the Azion API, or the Azion CLI.
You remove a cached object before its TTL ends from Azion Console, the Azion API v4, or the Azion CLI, naming it by URL, by cache key, or by a wildcard expression, in the Cache layer or in the Tiered Cache layer.
After a purge, the next request for the object goes to the origin, stores the version the origin returns, and carries x-cache: MISS. For what each purge type reaches, refer to Real-Time Purge.
Prerequisites
- The URL of the object to purge, or its cache key. To read the key, refer to Check the cache status of a response.
- A domain that belongs to your account. A purge of any other domain is rejected.
- Access to Azion Console, for the Console procedure. Refer to Access Azion Console.
- A personal token, for the API procedure.
- The Azion CLI installed and authorized, for the CLI procedure.
Choose the purge type
| To purge | Use | Argument |
|---|---|---|
| One or more exact objects | URL purge | Up to 50 URLs per request |
| Specific variations of an object | Cache key purge | Up to 50 cache keys per request; the only type that reaches Tiered Cache |
| Every object matching a pattern | Wildcard purge | One expression with * per request |
To remove an object held in both layers, purge Tiered Cache first and then Cache, so the first layer is not refilled from a stale copy in the second.
Purge through Azion Console
To send a purge from the Console:
Access Azion Console > Products Menu > Real-Time Purge.
Select the purge type that matches your argument, and the layer to clear: Cache, or Tiered Cache for a cache key purge.
Enter one object per item for a URL or cache key purge, or the single expression for a wildcard purge.
A message confirms the creation. Azion queues the purge, and it appears in the purge history once it completes.
Purge through the API
Each purge type is a path of its own on the purge endpoint. To send one:
The API answers with HTTP 201, state set to executed, and the items it purged:
The cachekey path is the one that accepts tiered_cache as the layer:
Each request answers the same way, with its own items and layer under data. Without layer, the API purges cache.
Purge through the Azion CLI
One command sends each purge type. To send them:
The command prints one line:
The --layer flag takes cache or tiered_cache, and defaults to cache:
Each command prints the same confirmation line. A rejected purge prints the API’s message instead, so run the command without --format json to read it.
Verify the purge
To confirm the copy is gone:
The response carries MISS, because Azion fetched the object from the origin again:
A response that reaches the origin after a purge confirms the copy left the cache.
Purge an object that varies
A URL purge converts each URL to one cache key and ignores content variation, so a copy that varies by cookie, device group, or image format survives it. Purge those variations by listing every key in a cache key purge, or with a wildcard that ends in @@* for cookie, device, and method variations, or ?* for query-string variations.
A query-string variation is the exception a URL purge does reach, as long as the arguments are in the order the key holds them, or in alphabetical order when Sort is on in the cache setting. For the keys each variation produces, refer to Cache keys, and for what each purge type reaches, to Real-Time Purge.