Enum http_cache_reqwest::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.
Trait Implementations§
source§impl PartialEq for CacheMode
impl PartialEq for CacheMode
impl Copy for CacheMode
impl Eq for CacheMode
impl StructuralEq for CacheMode
impl StructuralPartialEq for CacheMode
Auto Trait Implementations§
impl RefUnwindSafe for CacheMode
impl Send for CacheMode
impl Sync for CacheMode
impl Unpin for CacheMode
impl UnwindSafe for CacheMode
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.