Expand description
An implementation of a reqwest
middleware that uses
http-cache-stream
.
use http_cache_stream_reqwest::Cache;
use http_cache_stream_reqwest::storage::DefaultCacheStorage;
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_middleware::Result;
#[tokio::main]
async fn main() -> Result<()> {
let client = ClientBuilder::new(Client::new())
.with(Cache::new(DefaultCacheStorage::new("./cache")))
.build();
client.get("https://example.com").send().await?;
Ok(())
}
Modules§
- storage
- Implementation of cache storage.
Structs§
- Cache
- Implements a caching middleware for
reqwest
. - Cache
Options - Configuration options which control behavior of the cache. Use with
CachePolicy::new_options()
.
Constants§
- X_CACHE
- The name of the
x-cache
custom header. - X_
CACHE_ DIGEST - The name of the
x-cache-digest
custom header. - X_
CACHE_ LOOKUP - The name of the
x-cache-lookup
custom header.
Traits§
- Cache
Storage - A trait implemented on cache storage.