Crate reqwest_middleware_cache

Source
Expand description

A caching middleware for Reqwest that follows HTTP caching rules. By default it uses cacache as the backend cache manager.

§Example

use reqwest::Client;
use reqwest_middleware::{ClientBuilder, Result};
use reqwest_middleware_cache::{managers::CACacheManager, Cache, CacheMode};

#[tokio::main]
async fn main() -> Result<()> {
    let client = ClientBuilder::new(Client::new())
        .with(Cache {
            mode: CacheMode::Default,
            cache_manager: CACacheManager::default(),
        })
        .build();
    client
        .get("https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching")
        .send()
        .await?;
    Ok(())
}

Modules§

  • Backend cache managers, cacache is the default.

Structs§

  • Caches requests according to http spec

Enums§

Traits§

  • A trait providing methods for storing, reading, and removing cache records.