Rust

fastly

Module

Fastly's purge API.

Contents

use utopia_cdn::cache::fastly::Fastly;
Rust
pub struct Fastly<C = DefaultClient>

Purges a Fastly service: single URLs, surrogate keys, or everything.

Fastly cannot purge by host, so a domain is addressed by the surrogate key the origin attaches to every response it serves for it: the domain_key_prefix followed by the hostname (pass "" when the key is the bare hostname). Key, domain and zone purges need a service ID; without one they fail with Error::UnsupportedOperation, while URL purges still work.

Rust
use utopia_cdn::cache::{Adapter, Fastly};

let fastly = Fastly::new("api-token", "domain-").with_service_id("service-id").with_soft_purge(true);
fastly.purge_domain("example.com").await?; // purges the key `domain-example.com`
Compiles in CI; needs a running service to execute.