Enum actix_web_lab::header::CacheDirective
source · #[non_exhaustive]pub enum CacheDirective {
}
Expand description
Directives contained in a CacheControl
header.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MaxAge(u32)
The max-age=N
directive.
When used as a request directive, it indicates that the client allows a stored response that
is generated on the origin server within N seconds — where N
may be any non-negative
integer (including 0). Read more on MDN.
When used as a response directive, it indicates that the response remains fresh until N
seconds after the response is generated. Read more on MDN.
MaxStale(u32)
The max-stale=N
request directive.
This directive indicates that the client allows a stored response that is stale within N
seconds. Read more on MDN.
MinFresh(u32)
The min-fresh=N
request directive.
This directive indicates that the client allows a stored response that is fresh for at least
N
seconds. Read more on MDN.
SMaxAge(u32)
The s-maxage=N
response directive.
This directive also indicates how long the response is fresh for (similar to max-age
)—but
it is specific to shared caches, and they will ignore max-age
when it is present. Read
more on MDN.
NoCache
The no-cache
directive.
When used as a request directive, it asks caches to validate the response with the origin server before reuse. Read more on MDN.
When used as a response directive, it indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. Read more on MDN.
NoStore
The no-store
directive.
When used as a request directive, it allows a client to request that caches refrain from storing the request and corresponding response — even if the origin server’s response could be stored. Read more on MDN.
When used as a response directive, it indicates that the response can be stored in caches, but the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server. Read more on MDN.
NoTransform
The no-transform
directive.
This directive, in both request and response contexts, indicates that any intermediary (regardless of whether it implements a cache) shouldn’t transform the response contents. Read more on MDN.
OnlyIfCached
The only-if-cached
request directive.
This directive indicates that caches should obtain an already-cached response. If a cache has stored a response, it’s reused. Read more on MDN.
MustRevalidate
The must-revalidate
response directive.
This directive indicates that the response can be stored in caches and can be reused while fresh. If the response becomes stale, it must be validated with the origin server before reuse. Read more on MDN.
ProxyRevalidate
The proxy-revalidate
response directive.
This directive is the equivalent of must-revalidate, but specifically for shared caches only. Read more on MDN.
MustUnderstand
The must-understand
response directive.
This directive indicates that a cache should store the response only if it understands the requirements for caching based on status code. Read more on MDN.
Private
The private
response directive.
This directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers). Read more on MDN.
Public
The public
response directive.
This directive indicates that the response can be stored in a shared cache. Responses for
requests with Authorization
header fields must not be stored in a shared cache; however,
the public
directive will cause such responses to be stored in a shared cache. Read more
on MDN.
Immutable
The immutable
response directive.
This directive indicates that the response will not be updated while it’s fresh. Read more on MDN.
StaleWhileRevalidate
The stale-while-revalidate
response directive.
This directive indicates that the cache could reuse a stale response while it revalidates it to a cache. Read more on MDN.
StaleIfError
The stale-if-error
directive.
When used as a response directive, it indicates that the cache can reuse a stale response when an origin server responds with an error (500, 502, 503, or 504). Read more on MDN.
Extension(String, Option<String>)
Extension directive.
An unknown directives is collected into this variant with an optional argument value.
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 Display for CacheDirective
impl Display for CacheDirective
source§impl FromStr for CacheDirective
impl FromStr for CacheDirective
source§impl PartialEq for CacheDirective
impl PartialEq for CacheDirective
impl Eq for CacheDirective
impl StructuralPartialEq for CacheDirective
Auto Trait Implementations§
impl Freeze for CacheDirective
impl RefUnwindSafe for CacheDirective
impl Send for CacheDirective
impl Sync for CacheDirective
impl Unpin for CacheDirective
impl UnwindSafe for CacheDirective
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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