Enum http_types::cache::CacheDirective
source · #[non_exhaustive]pub enum CacheDirective {
}
Expand description
An HTTP Cache-Control
directive.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Immutable
The response body will not change over time.
MaxAge(Duration)
The maximum amount of time a resource is considered fresh.
MaxStale(Option<Duration>)
Indicates the client will accept a stale response.
MinFresh(Duration)
A response that will still be fresh for at least the specified duration.
MustRevalidate
Once a response is stale, a fresh response must be retrieved.
NoCache
The response may be cached, but must always be revalidated before being used.
NoStore
The response may not be cached.
NoTransform
An intermediate cache or proxy should not edit the response body, Content-Encoding, Content-Range, or Content-Type.
OnlyIfCached
Do not use the network for a response.
Private
The response may be stored only by a browser’s cache, even if the response is normally non-cacheable.
ProxyRevalidate
Like must-revalidate, but only for shared caches (e.g., proxies).
Public
The response may be stored by any cache, even if the response is normally non-cacheable.
SMaxAge(Duration)
Overrides max-age or the Expires header, but only for shared caches.
StaleIfError(Duration)
The client will accept a stale response if retrieving a fresh one fails.
StaleWhileRevalidate(Duration)
Indicates the client will accept a stale response, while asynchronously checking in the background for a fresh one.
Implementations§
source§impl CacheDirective
impl CacheDirective
sourcepub fn valid_in_req(&self) -> bool
pub fn valid_in_req(&self) -> bool
Check whether this directive is valid in an HTTP request.
sourcepub fn valid_in_res(&self) -> bool
pub fn valid_in_res(&self) -> bool
Check whether this directive is valid in an HTTP response.
Trait Implementations§
source§impl Clone for CacheDirective
impl Clone for CacheDirective
source§fn clone(&self) -> CacheDirective
fn clone(&self) -> CacheDirective
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CacheDirective
impl Debug for CacheDirective
source§impl From<CacheDirective> for HeaderValue
impl From<CacheDirective> for HeaderValue
source§fn from(directive: CacheDirective) -> Self
fn from(directive: CacheDirective) -> Self
source§impl PartialEq<CacheDirective> for CacheDirective
impl PartialEq<CacheDirective> for CacheDirective
source§fn eq(&self, other: &CacheDirective) -> bool
fn eq(&self, other: &CacheDirective) -> bool
self
and other
values to be equal, and is used
by ==
.