CacheOverride
123456789101112pub enum CacheOverride { None, Pass, Override { ttl: Option<u32>, stale_while_revalidate: Option<u32>, stale_if_error: Option<u32>, pci: bool, surrogate_key: Option<HeaderValue>, lookup_timeout_ms: Option<u32>, },}Optional override for response caching behavior. These options mostly apply during host caching, but guest caching also respects them.
Variants
Override particular cache control settings.
The origin response's cache control headers will be used for ttl (maxage), stalewhilerevalidate, and staleiferror if None.
Note that staleif_error is only supported via the guest caching API.
ttl: Option<u32>
stale_while_revalidate: Option<u32>
stale_if_error: Option<u32>
pci: bool
surrogate_key: Option<http::header::HeaderValue>
lookup_timeout_ms: Option<u32>
Methods
default
View sourceconst fn default() -> SelfReturn a default set of overrides (no overrides)
Returns
get_lookup_timeout
View sourceGet the lookup timeout period configured on this override
Parameters
- self: &Self
Returns
get_stale_if_error
View sourceGet the SIE period configured on this override
Parameters
- self: &Self
Returns
get_stale_while_revalidate
View sourceGet the SWR period configured on this override
Parameters
- self: &Self
Returns
get_surrogate_key
View sourceGet the surrogate keys configured on this override
Parameters
- self: &Self
Returns
is_pass
View sourcefn is_pass(&self) -> boolReturns true if this override will cause the request to bypass the cache
Parameters
- self: &Self
Returns
lookup_timeout
View sourceconst fn lookup_timeout(timeout_ms: u32) -> SelfCreate a CacheOverride that overrides (only) the cache lookup timeout. Timeout given in milliseconds.
Parameters
- timeout_ms: u32
Returns
pci
View sourceconst fn pci(pci: bool) -> SelfCreate a CacheOverride that overrides (only) the sensitive data bit; if set, prevents the response from being stored in persistent storage
Parameters
- pci: bool
Returns
set_lookup_timeout
View sourceSet the cache lookup timeout configured on this override; value rounded to milliseconds.
Parameters
- self: &mut Self
- timeout: std::time::Duration
set_none
View sourcefn set_none(&mut self)Updates the CacheOverride to override no fields
Parameters
- self: &mut Self
set_pass
View sourcefn set_pass(&mut self, pass: bool)Updates the CacheOverride provide the given Pass behavior; if pass is false, clears all overrides and reverts to the default behavior
Parameters
- self: &mut Self
- pass: bool
set_pci
View sourcefn set_pci(&mut self, new_pci: bool)Set the sensitive-data override setting
Parameters
- self: &mut Self
- new_pci: bool
set_stale_if_error
View sourcefn set_stale_if_error(&mut self, new_sie: u32)Set the SIE period configured on this override
Parameters
- self: &mut Self
- new_sie: u32
set_stale_while_revalidate
View sourcefn set_stale_while_revalidate(&mut self, new_swr: u32)Set the SWR period configured on this override
Parameters
- self: &mut Self
- new_swr: u32
set_surrogate_key
View sourceSet the surrogate keys configured on this override
Parameters
- self: &mut Self
- new_surrogate_key: HeaderValue
set_ttl
View sourcefn set_ttl(&mut self, new_ttl: u32)Set the TTL configured on this override
Parameters
- self: &mut Self
- new_ttl: u32
stale_if_error
View sourceconst fn stale_if_error(sie: u32) -> SelfCreate a CacheOverride that overrides (only) the stale-if-error period
Parameters
- sie: u32
Returns
stale_while_revalidate
View sourceconst fn stale_while_revalidate(swr: u32) -> SelfCreate a CacheOverride that overrides (only) the stale-while-revalidate period
Parameters
- swr: u32
Returns
surrogate_key
View sourceCreate a CacheOverride that overrides (only) the surrogate keys
Parameters
- sk: HeaderValue
Returns
ttl
View sourceconst fn ttl(ttl: u32) -> SelfCreate a CacheOverride that overrides (only) the TTL
Parameters
- ttl: u32
Returns