Enum http_cache::CacheMode
source · [−]pub enum CacheMode {
Default,
NoStore,
Reload,
NoCache,
ForceCache,
OnlyIfCached,
}Expand description
Similar to make-fetch-happen cache options.
Passed in when the HttpCache struct is being built.
Variants
Default
Will inspect the HTTP cache on the way to the network. If there is a fresh response it will be used. If there is a stale response a conditional request will be created, and a normal request otherwise. It then updates the HTTP cache with the response. If the revalidation request fails (for example, on a 500 or if you’re offline), the stale response will be returned.
NoStore
Behaves as if there is no HTTP cache at all.
Reload
Behaves as if there is no HTTP cache on the way to the network. Ergo, it creates a normal request and updates the HTTP cache with the response.
NoCache
Creates a conditional request if there is a response in the HTTP cache and a normal request otherwise. It then updates the HTTP cache with the response.
ForceCache
Uses any response in the HTTP cache matching the request, not paying attention to staleness. If there was no response, it creates a normal request and updates the HTTP cache with the response.
OnlyIfCached
Uses any response in the HTTP cache matching the request, not paying attention to staleness. If there was no response, it returns a network error.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for CacheMode
impl UnwindSafe for CacheMode
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more