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

CACacheManagermanager-cacache

Implements 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

MokaCachemanager-moka

A thread-safe, futures-aware concurrent in-memory cache.

MokaCacheBuildermanager-moka

Builds a Cache with various configuration knobs.

MokaManagermanager-moka

Implements 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-lookup

Represents an HTTP version

Constants

x-cache header: Value will be HIT if the response was served from cache, MISS if not

x-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 Definitions

A Result typedef to use with the CacheError type