Expand description
A caching middleware that follows HTTP caching rules, thanks to
http-cache-semantics
.
By default, it uses cacache
as the backend cache manager.
§Features
The following features are available. By default manager-cacache
and cacache-async-std
are enabled.
manager-cacache
(default): enable cacache, a high-performance disk cache, backend manager.cacache-async-std
(default): enable async-std runtime support for cacache.cacache-tokio
(disabled): enable tokio runtime support for cacache.manager-moka
(disabled): enable moka, a high-performance in-memory cache, backend manager.with-http-types
(disabled): enable http-types type conversion support
Structs§
- Error type for bad header values
- Error type for unknown http versions
- Implements
CacheManager
withcacache
as the backend. - Options struct provided by
http-cache-semantics
. Configuration options which control behavior of the cache. Use withCachePolicy::new_options()
. - Caches requests according to http spec.
- Can be used to override the default
CacheOptions
and cache key. The cache key is a closure that takeshttp::request::Parts
and returns aString
. - A basic generic type that represents an HTTP response
Enums§
- Similar to make-fetch-happen cache options. Passed in when the
HttpCache
struct is being built. - Represents a basic cache status Used in the custom headers
x-cache
andx-cache-lookup
- Represents an HTTP version
Constants§
x-cache
header: Value will be HIT if the response was served from cache, MISS if notx-cache-lookup
header: Value will be HIT if a response existed in cache, MISS if not
Traits§
- A trait providing methods for storing, reading, and removing cache records.
- Describes the functionality required for interfacing with HTTP client middleware
Type Aliases§
- Generic error type for the
HttpCache
middleware. - A closure that takes
http::request::Parts
,Option<CacheKey>
, the default cache key ([&str``]) and returns [
Vec`] of keys to bust the cache for. An empty vector means that no cache busting will be performed. - A closure that takes
http::request::Parts
and returns aString
. By default, the cache key is a combination of the request method and uri with a colon in between. - A closure that takes
http::request::Parts
and returns aCacheMode
- A
Result
typedef to use with theBoxError
type