Struct http_cache::HttpCache
source · pub struct HttpCache<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: CacheManager> HttpCache<T>
impl<T: CacheManager> HttpCache<T>
sourcepub fn can_cache_request(&self, middleware: &impl Middleware) -> Result<bool>
pub fn can_cache_request(&self, middleware: &impl Middleware) -> Result<bool>
Determines if the request should be cached
sourcepub async fn run_no_cache(&self, middleware: &mut impl Middleware) -> Result<()>
pub async fn run_no_cache(&self, middleware: &mut impl Middleware) -> Result<()>
Runs the actions to preform when the client middleware is running without the cache
sourcepub async fn run(&self, middleware: impl Middleware) -> Result<HttpResponse>
pub async fn run(&self, middleware: impl Middleware) -> Result<HttpResponse>
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