A caching middleware for Surf.
Ships with cacache as the default manager.
Cargo.toml
toml
[dependencies]
surf-middleware-cache = "0.2.0"
With cargo add installed :
sh
cargo add surf-middleware-cache
```rust use surfmiddlewarecache::{managers::CACacheManager, Cache, CacheMode};
async fn main() -> surf::Result<()> { let req = surf::get("https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching"); surf::client() .with(Cache { mode: CacheMode::Default, cache_manager: CACacheManager::default(), }) .send(req) .await?; Ok(()) } ```
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.This project is licensed under the Apache-2.0 License