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-cacacheImplementsCacheManagerwithcacacheas 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.
- A basic generic type that represents an HTTP response
- MokaCache
manager-mokaA thread-safe, futures-aware concurrent in-memory cache. - MokaCacheBuilder
manager-mokaBuilds aCachewith various configuration knobs. - MokaManager
manager-mokaImplementsCacheManagerwithmokaas the backend.
Enums
- A generic “error” for HTTP caches
- Similar to make-fetch-happen cache options. Passed in when the
HttpCachestruct is being built. - Represents a basic cache status Used in the custom headers
x-cacheandx-cache-lookup - Represents an HTTP version
Constants
x-cacheheader: Value will be HIT if the response was served from cache, MISS if notx-cache-lookupheader: 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 Definitions
- A
Resulttypedef to use with theCacheErrortype