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<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 ==
.impl Eq for CacheDirective
impl StructuralEq for CacheDirective
impl StructuralPartialEq for CacheDirective
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.