pub struct CacheService { /* private fields */ }Expand description
Service for purging cache.
Obtain an instance via CloudflareClient::cache().
Implementations§
Source§impl CacheService
impl CacheService
Sourcepub async fn purge_everything(
&self,
zone_id: impl Into<String>,
) -> Result<PurgeResponse>
pub async fn purge_everything( &self, zone_id: impl Into<String>, ) -> Result<PurgeResponse>
Purge all cached content for a zone.
Warning: This will purge everything from the cache and may significantly increase load on your origin server.
§Examples
client.cache()
.purge_everything("zone_id")
.await?;Sourcepub fn purge_urls(&self, zone_id: impl Into<String>) -> PurgeUrlsRequest
pub fn purge_urls(&self, zone_id: impl Into<String>) -> PurgeUrlsRequest
Purge specific URLs from cache.
You can purge up to 30 URLs at a time.
§Examples
client.cache()
.purge_urls("zone_id")
.urls(vec![
"https://example.com/page1",
"https://example.com/page2",
])
.send()
.await?;Purge cache by cache tags.
Cache tags are used to identify cached content. You can purge up to 30 tags at a time. This feature requires an Enterprise plan.
§Examples
client.cache()
.purge_tags("zone_id")
.tags(vec!["product", "blog"])
.send()
.await?;Sourcepub fn purge_hosts(&self, zone_id: impl Into<String>) -> PurgeHostsRequest
pub fn purge_hosts(&self, zone_id: impl Into<String>) -> PurgeHostsRequest
Purge cache by hosts.
Purge all cached content for specific hosts. You can purge up to 30 hosts at a time. This feature requires an Enterprise plan.
§Examples
client.cache()
.purge_hosts("zone_id")
.hosts(vec!["www.example.com", "api.example.com"])
.send()
.await?;Sourcepub fn purge_prefixes(&self, zone_id: impl Into<String>) -> PurgePrefixesRequest
pub fn purge_prefixes(&self, zone_id: impl Into<String>) -> PurgePrefixesRequest
Purge cache by prefixes.
Purge all cached content with URLs that begin with specific prefixes. You can purge up to 30 prefixes at a time. This feature requires an Enterprise plan.
§Examples
client.cache()
.purge_prefixes("zone_id")
.prefixes(vec!["example.com/images/", "example.com/videos/"])
.send()
.await?;Trait Implementations§
Source§impl Clone for CacheService
impl Clone for CacheService
Source§fn clone(&self) -> CacheService
fn clone(&self) -> CacheService
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more