Azion CLI purge
Azion CLI command that purges cached objects by URL, cache key, or wildcard from Cache or Tiered Cache, with every flag, its type, and its default.
The Azion CLI purge command removes cached objects before their TTL ends, so the next request fetches the current version from the origin. It sends a Real-Time Purge of one of three types: a list of URLs, a list of cache keys, or one wildcard expression. The purge clears the Cache layer by default, or the Tiered Cache layer with --layer tiered_cache. The options every command accepts, such as --format, --out, and -y, are on Global options.
Usage
azion purge takes the purge type from one of three flags, --urls, --cachekey, or --wildcard:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--cachekey | — | string | — | Comma-separated list of cache keys to purge. The only purge type that the tiered_cache layer accepts. |
--layer | — | string | "cache" | Layer the purge runs on: cache or tiered_cache. |
--urls | — | string | — | Comma-separated list of URLs to purge, with or without the scheme. |
--wildcard | — | string | — | One wildcard expression, a URL or a cache key with an asterisk (*), that matches the objects to purge. |
A URL without a scheme covers both the HTTP and the HTTPS copies of the object. A wildcard purge takes one expression per request, so a second expression fails with Only one item is allowed for the Wildcard option. URL and wildcard purges run on the cache layer only: with --layer tiered_cache, they fail with Invalid purge layer for purge type "url"., or the same error naming "wildcard". For the format of each argument, refer to Real-Time Purge.
Examples
Each example shows the command and the output it prints.
Purge a list of URLs
This command purges two pages of a site from the Cache layer:
The command confirms the purge:
The same command accepts each URL with its scheme, such as https://xxxxxxxxxx.map.azionedge.net/index.html.
Purge with a wildcard expression
This command purges every object under the root path of a site:
The command confirms the purge:
Purge a list of cache keys
This command purges the cache keys of two pages from the Cache layer:
The command confirms the purge:
Purge a cache key from Tiered Cache
This command purges one cache key from the Tiered Cache layer:
The command confirms the purge:
Choose the purge type at a prompt
In a terminal, the command asks for the purge type when you pass no purge type flag:
The command lists the three purge types:
After you choose URL, the command asks Enter the URLs you wish to purge, separated by commas. Without a terminal, such as in a script, the command fails with Error: EOF, so pass --urls, --cachekey, or --wildcard instead.