Struct http_cache_reqwest::HttpCache
source · pub struct HttpCache<T>where
T: CacheManager,{
pub mode: CacheMode,
pub manager: T,
pub options: HttpCacheOptions,
}
Expand description
Caches requests according to http spec.
Fields§
§mode: CacheMode
Determines the manager behavior.
manager: T
Manager instance that implements the CacheManager
trait.
By default, a manager implementation with cacache
as the backend has been provided, see CACacheManager
.
options: HttpCacheOptions
Override the default cache options.
Implementations§
source§impl<T> HttpCache<T>where
T: CacheManager,
impl<T> HttpCache<T>where
T: CacheManager,
sourcepub fn can_cache_request(
&self,
middleware: &impl Middleware
) -> Result<bool, Box<dyn Error + Send + Sync>>
pub fn can_cache_request( &self, middleware: &impl Middleware ) -> Result<bool, Box<dyn Error + Send + Sync>>
Determines if the request should be cached
sourcepub async fn run_no_cache(
&self,
middleware: &mut impl Middleware
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn run_no_cache( &self, middleware: &mut impl Middleware ) -> Result<(), Box<dyn Error + Send + Sync>>
Runs the actions to preform when the client middleware is running without the cache
sourcepub async fn run(
&self,
middleware: impl Middleware
) -> Result<HttpResponse, Box<dyn Error + Send + Sync>>
pub async fn run( &self, middleware: impl Middleware ) -> Result<HttpResponse, Box<dyn Error + Send + Sync>>
Attempts to run the passed middleware along with the cache
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for HttpCache<T>
impl<T> Send for HttpCache<T>
impl<T> Sync for HttpCache<T>
impl<T> Unpin for HttpCache<T>where
T: Unpin,
impl<T> !UnwindSafe for HttpCache<T>
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