pub 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>,
},
}Expand description
Optional override for response caching behavior. These options mostly apply during host caching, but guest caching also respects them.
Variants§
None
Do not override the behavior specified in the origin response’s cache control headers.
Pass
Do not cache the response to this request, regardless of the origin response’s headers.
Override
Override particular cache control settings.
The origin response’s cache control headers will be used for ttl (max_age), stale_while_revalidate, and stale_if_error if None.
Note that stale_if_error is only supported via the guest caching API.
Fields
pci: boolWhether this response will contain sensitive data (e.g. PCI or HIPAA) that must not be stored in persistent storage.
surrogate_key: Option<HeaderValue>Surrogate keys (space-separated) to store the cached response under.
Implementations§
Source§impl CacheOverride
impl CacheOverride
Sourcepub fn is_pass(&self) -> bool
pub fn is_pass(&self) -> bool
Returns true if this override will cause the request to bypass the cache
Sourcepub const fn stale_while_revalidate(swr: u32) -> Self
pub const fn stale_while_revalidate(swr: u32) -> Self
Create a CacheOverride that overrides (only) the stale-while-revalidate period
Sourcepub const fn stale_if_error(sie: u32) -> Self
pub const fn stale_if_error(sie: u32) -> Self
Create a CacheOverride that overrides (only) the stale-if-error period
Sourcepub const fn pci(pci: bool) -> Self
pub const fn pci(pci: bool) -> Self
Create a CacheOverride that overrides (only) the sensitive data bit; if set, prevents the response from being stored in persistent storage
Sourcepub const fn surrogate_key(sk: HeaderValue) -> Self
pub const fn surrogate_key(sk: HeaderValue) -> Self
Create a CacheOverride that overrides (only) the surrogate keys
Sourcepub const fn lookup_timeout(timeout_ms: u32) -> Self
pub const fn lookup_timeout(timeout_ms: u32) -> Self
Create a CacheOverride that overrides (only) the cache lookup timeout. Timeout given in milliseconds.
Sourcepub fn set_pass(&mut self, pass: bool)
pub fn 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
Sourcepub fn get_stale_while_revalidate(&self) -> Option<u32>
pub fn get_stale_while_revalidate(&self) -> Option<u32>
Get the SWR period configured on this override
Sourcepub fn set_stale_while_revalidate(&mut self, new_swr: u32)
pub fn set_stale_while_revalidate(&mut self, new_swr: u32)
Set the SWR period configured on this override
Sourcepub fn get_stale_if_error(&self) -> Option<u32>
pub fn get_stale_if_error(&self) -> Option<u32>
Get the SIE period configured on this override
Sourcepub fn set_stale_if_error(&mut self, new_sie: u32)
pub fn set_stale_if_error(&mut self, new_sie: u32)
Set the SIE period configured on this override
Sourcepub fn get_surrogate_key(&self) -> Option<&HeaderValue>
pub fn get_surrogate_key(&self) -> Option<&HeaderValue>
Get the surrogate keys configured on this override
Sourcepub fn set_surrogate_key(&mut self, new_surrogate_key: HeaderValue)
pub fn set_surrogate_key(&mut self, new_surrogate_key: HeaderValue)
Set the surrogate keys configured on this override
Sourcepub fn get_lookup_timeout(&self) -> Option<Duration>
pub fn get_lookup_timeout(&self) -> Option<Duration>
Get the lookup timeout period configured on this override
Sourcepub fn set_lookup_timeout(&mut self, timeout: Duration)
pub fn set_lookup_timeout(&mut self, timeout: Duration)
Set the cache lookup timeout configured on this override; value rounded to milliseconds.
Trait Implementations§
Source§impl Clone for CacheOverride
impl Clone for CacheOverride
Source§impl Debug for CacheOverride
impl Debug for CacheOverride
Auto Trait Implementations§
impl !Freeze for CacheOverride
impl RefUnwindSafe for CacheOverride
impl Send for CacheOverride
impl Sync for CacheOverride
impl Unpin for CacheOverride
impl UnsafeUnpin for CacheOverride
impl UnwindSafe for CacheOverride
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more