#[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 more