Enum http_cache::CacheMode
source · pub enum CacheMode {
Default,
NoStore,
Reload,
NoCache,
ForceCache,
OnlyIfCached,
IgnoreRules,
}
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.
IgnoreRules
Overrides the check that determines if a response can be cached to always return true on 200. 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.