Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

06chaynes/reqwest-middleware-cache

Repository files navigation

reqwest-middleware-cache

NOTE: This crate is deprecated in favor of http-cache.

Rust crates.io Docs.rs

A caching middleware for reqwest that follows HTTP caching rules, thanks to http-cache-semantics. By default it uses cacache as the backend cache manager. Uses reqwest-middleware for middleware support.

Install

With cargo add installed :

cargo add reqwest-middleware-cache

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(())
}

Features

The following features are available. By default manager-cacache is enabled.

  • manager-cacache (default): use cacache, a high-performance disk cache, for the manager backend.

Documentation

License

This project is licensed under the Apache-2.0 License

About

http caching middleware for the reqwest http client

Resources

License

Unknown and 3 other licenses found

Licenses found

Unknown
LICENSE.md
Unknown
LICENSE-APACHE.md
Unknown
LICENSE-PARITY.md
Unknown
LICENSE-PATRON.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages