[][src]Struct http_cache_semantics::CachePolicyOptions

pub struct CachePolicyOptions {
    pub shared: bool,
    pub cache_heuristic: f32,
    pub immutable_min_time_to_live: Duration,
    pub ignore_cargo_cult: bool,
    pub trust_server_date: bool,
    pub response_time: SystemTime,
}

Holds configuration options which control the behavior of the cache and are independent of any specific request or response.

Fields

shared: bool

If shared is true (default), then the response is evaluated from a perspective of a shared cache (i.e. private is not cacheable and s-maxage is respected). If shared is false, then the response is evaluated from a perspective of a single-user cache (i.e. private is cacheable and s-maxage is ignored). shared: true is recommended for HTTP clients.

cache_heuristic: f32

cache_heuristic is a fraction of response's age that is used as a fallback cache duration. The default is 0.1 (10%), e.g. if a file hasn't been modified for 100 days, it'll be cached for 100*0.1 = 10 days.

immutable_min_time_to_live: Duration

immutable_min_time_to_live is a duration to assume as the default time to cache responses with Cache-Control: immutable. Note that per RFC these can become stale, so max-age still overrides the default.

ignore_cargo_cult: bool

If ignore_cargo_cult is true, common anti-cache directives will be completely ignored if the non-standard pre-check and post-check directives are present. These two useless directives are most commonly found in bad StackOverflow answers and PHP's "session limiter" defaults.

trust_server_date: bool

If trust_server_date is false, then server's Date header won't be used as the base for max-age. This is against the RFC, but it's useful if you want to cache responses with very short max-age, but your local clock is not exactly in sync with the server's.

response_time: SystemTime

When the response has been received. SystemTime::now.

Trait Implementations

impl Clone for CachePolicyOptions[src]

impl Copy for CachePolicyOptions[src]

impl Debug for CachePolicyOptions[src]

impl Default for CachePolicyOptions[src]

impl<'de> Deserialize<'de> for CachePolicyOptions[src]

impl Serialize for CachePolicyOptions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.