Cache purging. When you update content at your origin, the CDN keeps serving the old cached version until it expires. Purging forces edge servers to fetch the new version immediately.
You can purge a single URL or an entire pull zone's cache. Uses the main API client
created with Bunnyx.new/1.
Usage
client = Bunnyx.new(api_key: "sk-...")
{:ok, nil} = Bunnyx.Purge.url(client, "https://example.com/image.png")
{:ok, nil} = Bunnyx.Purge.url(client, "https://example.com/", async: true, exact_path: true)
{:ok, nil} = Bunnyx.Purge.pull_zone(client, 12345)
{:ok, nil} = Bunnyx.Purge.pull_zone(client, 12345, cache_tag: "images")
Summary
Functions
@spec pull_zone(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Purges an entire pull zone's cache.
Options
:cache_tag— only purge items with this cache tag
@spec url(Bunnyx.t() | keyword(), String.t(), keyword()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Purges a URL from the CDN cache.
Options
:async— perform the purge asynchronously:exact_path— only purge the exact URL (no wildcard)