Crate http_cache
source ·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 is enabled.
manager-cacache(default): enable cacache, a high-performance disk cache, backend manager.manager-moka(disabled): enable moka, a high-performance in-memory cache, backend manager.with-http-types(disabled): enable http-types type conversion support
Structs
CACacheManager
manager-cacacheImplements
CacheManager with cacache as the backend.Options struct provided by
http-cache-semantics.
Configuration options which control behavior of the cache. Use with CachePolicy::new_options().Caches requests according to http spec.
A basic generic type that represents an HTTP response
MokaCache
manager-mokaA thread-safe, futures-aware concurrent in-memory cache.
MokaCacheBuilder
manager-mokaBuilds a
Cache with various configuration knobs.MokaManager
manager-mokaImplements
CacheManager with moka as the backend.Enums
A generic “error” for HTTP caches
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 and x-cache-lookupRepresents 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 notTraits
A trait providing methods for storing, reading, and removing cache records.
Describes the functionality required for interfacing with HTTP client middleware
Type Definitions
A
Result typedef to use with the CacheError type