pub struct CacheBypass(pub bool);Expand description
Per-request control for bypassing cache behavior.
When set to CacheBypass(true) in request extensions, the cache middleware
will skip both cache reads and cache writes for that request.
This is useful when you want a one-off fresh fetch while still reusing the same client, cache store, and throttle middleware stack.
§Example
use reqwest_drive::{CacheBypass, CachePolicy, ThrottlePolicy, init_cache_with_throttle};
use reqwest_middleware::ClientBuilder;
use tempfile::tempdir;
let temp_dir = tempdir().unwrap();
let cache_path = temp_dir.path().join("cache_storage.bin");
let (cache, throttle) = init_cache_with_throttle(
&cache_path,
CachePolicy::default(),
ThrottlePolicy::default(),
);
let client = ClientBuilder::new(reqwest::Client::new())
.with_arc(cache)
.with_arc(throttle)
.build();
let mut request = client.get("https://example.com");
request.extensions().insert(CacheBypass(true));
let _ = request.send().await;Tuple Fields§
§0: boolTrait Implementations§
Source§impl Clone for CacheBypass
impl Clone for CacheBypass
Source§fn clone(&self) -> CacheBypass
fn clone(&self) -> CacheBypass
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheBypass
impl Debug for CacheBypass
Source§impl Default for CacheBypass
impl Default for CacheBypass
Source§fn default() -> CacheBypass
fn default() -> CacheBypass
Returns the “default value” for a type. Read more
impl Copy for CacheBypass
Auto Trait Implementations§
impl Freeze for CacheBypass
impl RefUnwindSafe for CacheBypass
impl Send for CacheBypass
impl Sync for CacheBypass
impl Unpin for CacheBypass
impl UnsafeUnpin for CacheBypass
impl UnwindSafe for CacheBypass
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
Mutably borrows from an owned value. Read more