pingora_cache::cache_control

Struct CacheControl

Source
pub struct CacheControl {
    pub directives: DirectiveMap,
}
Expand description

Parsed Cache-Control directives

Fields§

§directives: DirectiveMap

The parsed directives

Implementations§

Source§

impl CacheControl

Source

pub fn from_headers_named( header_name: &str, headers: &HeaderMap, ) -> Option<Self>

Parse from the given header name in headers

Source

pub fn from_req_headers_named( header_name: &str, req_header: &ReqHeader, ) -> Option<Self>

Parse from the given header name in the ReqHeader

Source

pub fn from_req_headers(req_header: &ReqHeader) -> Option<Self>

Parse Cache-Control header name from the ReqHeader

Source

pub fn from_resp_headers_named( header_name: &str, resp_header: &RespHeader, ) -> Option<Self>

Parse from the given header name in the RespHeader

Source

pub fn from_resp_headers(resp_header: &RespHeader) -> Option<Self>

Parse Cache-Control header name from the RespHeader

Source

pub fn has_key(&self, key: &str) -> bool

Whether the given directive is in the cache control.

Source

pub fn public(&self) -> bool

Whether the public directive is in the cache control.

Source

pub fn private(&self) -> bool

Whether the standalone private exists in the cache control

Source

pub fn private_field_names(&self) -> Option<ListValueIter<'_>>

Get the values of private=

Source

pub fn no_cache(&self) -> bool

Whether the standalone no-cache exists in the cache control

Source

pub fn no_cache_field_names(&self) -> Option<ListValueIter<'_>>

Get the values of no-cache=

Source

pub fn no_store(&self) -> bool

Whether no-store exists.

Source

pub fn max_age(&self) -> Result<Option<u32>>

Return the max-age seconds

Source

pub fn s_maxage(&self) -> Result<Option<u32>>

Return the s-maxage seconds

Source

pub fn stale_while_revalidate(&self) -> Result<Option<u32>>

Return the stale-while-revalidate seconds

Source

pub fn stale_if_error(&self) -> Result<Option<u32>>

Return the stale-if-error seconds

Source

pub fn must_revalidate(&self) -> bool

Whether must-revalidate exists.

Source

pub fn proxy_revalidate(&self) -> bool

Whether proxy-revalidate exists.

Source

pub fn only_if_cached(&self) -> bool

Whether only-if-cached exists.

Trait Implementations§

Source§

impl Debug for CacheControl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl InterpretCacheControl for CacheControl

Source§

fn is_cacheable(&self) -> Cacheable

Does cache-control specify this response is cacheable? Read more
Source§

fn allow_caching_authorized_req(&self) -> bool

Does this cache-control allow caching a response to a request with the Authorization header?
Source§

fn fresh_sec(&self) -> Option<u32>

Returns freshness ttl specified in cache-control Read more
Source§

fn serve_stale_while_revalidate_sec(&self) -> Option<u32>

Returns stale-while-revalidate ttl, Read more
Source§

fn serve_stale_if_error_sec(&self) -> Option<u32>

Returns stale-if-error ttl, Read more
Source§

fn strip_private_headers(&self, resp_header: &mut ResponseHeader)

Strip header names listed in private or no-cache directives from a response, usually prior to storing that response in cache.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more