pub struct CacheOptions { /* private fields */ }Expand description
Configuration that controls cache behavior.
Implementations§
Source§impl CacheOptions
impl CacheOptions
Returns a copy of whether the cache is treated as a shared cache
Shared cache, suitable for a proxy or cdn: s-maxage is honored, private responses are
refused, and Authorization-bearing requests require explicit opt-in (public,
s-maxage, or must-revalidate)
Non-shared-cache (the default) treats the cache as a single-user (browser-style) private cache.
Default: false
Mutably borrow whether the cache is treated as a shared cache
Shared cache, suitable for a proxy or cdn: s-maxage is honored, private responses are
refused, and Authorization-bearing requests require explicit opt-in (public,
s-maxage, or must-revalidate)
Non-shared-cache (the default) treats the cache as a single-user (browser-style) private cache.
Default: false
Sets whether the cache is treated as a shared cache, returning &mut Self for chaining
Shared cache, suitable for a proxy or cdn: s-maxage is honored, private responses are
refused, and Authorization-bearing requests require explicit opt-in (public,
s-maxage, or must-revalidate)
Non-shared-cache (the default) treats the cache as a single-user (browser-style) private cache.
Default: false
Owned chainable setter for whether the cache is treated as a shared cache, returning Self
Shared cache, suitable for a proxy or cdn: s-maxage is honored, private responses are
refused, and Authorization-bearing requests require explicit opt-in (public,
s-maxage, or must-revalidate)
Non-shared-cache (the default) treats the cache as a single-user (browser-style) private cache.
Default: false
Sourcepub fn cache_heuristic(&self) -> f32
pub fn cache_heuristic(&self) -> f32
Returns a copy of heuristic-freshness ratio
When a response has no explicit expiration but does have Last-Modified, freshness
lifetime is computed as cache_heuristic * (Date - Last-Modified).
Default: 0.1 (10%)
Sourcepub fn cache_heuristic_mut(&mut self) -> &mut f32
pub fn cache_heuristic_mut(&mut self) -> &mut f32
Mutably borrow heuristic-freshness ratio
When a response has no explicit expiration but does have Last-Modified, freshness
lifetime is computed as cache_heuristic * (Date - Last-Modified).
Default: 0.1 (10%)
Sourcepub fn set_cache_heuristic(&mut self, cache_heuristic: f32) -> &mut Self
pub fn set_cache_heuristic(&mut self, cache_heuristic: f32) -> &mut Self
Sets heuristic-freshness ratio, returning &mut Self for chaining
When a response has no explicit expiration but does have Last-Modified, freshness
lifetime is computed as cache_heuristic * (Date - Last-Modified).
Default: 0.1 (10%)
Sourcepub fn with_cache_heuristic(self, cache_heuristic: f32) -> Self
pub fn with_cache_heuristic(self, cache_heuristic: f32) -> Self
Owned chainable setter for heuristic-freshness ratio, returning Self
When a response has no explicit expiration but does have Last-Modified, freshness
lifetime is computed as cache_heuristic * (Date - Last-Modified).
Default: 0.1 (10%)
Sourcepub fn immutable_min_time_to_live(&self) -> Duration
pub fn immutable_min_time_to_live(&self) -> Duration
Returns a copy of the default freshness lifetime for responses with Cache-Control: immutable and no other expiration
Default: 24h
Sourcepub fn immutable_min_time_to_live_mut(&mut self) -> &mut Duration
pub fn immutable_min_time_to_live_mut(&mut self) -> &mut Duration
Mutably borrow the default freshness lifetime for responses with Cache-Control: immutable and no other expiration
Default: 24h
Sourcepub fn set_immutable_min_time_to_live(
&mut self,
immutable_min_time_to_live: Duration,
) -> &mut Self
pub fn set_immutable_min_time_to_live( &mut self, immutable_min_time_to_live: Duration, ) -> &mut Self
Sets the default freshness lifetime for responses with Cache-Control:, returning &mut Self for chaining immutable and no other expiration
Default: 24h
Sourcepub fn with_immutable_min_time_to_live(
self,
immutable_min_time_to_live: Duration,
) -> Self
pub fn with_immutable_min_time_to_live( self, immutable_min_time_to_live: Duration, ) -> Self
Owned chainable setter for the default freshness lifetime for responses with Cache-Control:, returning Self immutable and no other expiration
Default: 24h
Trait Implementations§
Source§impl Clone for CacheOptions
impl Clone for CacheOptions
Source§fn clone(&self) -> CacheOptions
fn clone(&self) -> CacheOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more