Skip to main content

Crate hyperlane_plugin_cache

Crate hyperlane_plugin_cache 

Source
Expand description

hyperlane-plugin-cache

64-way sharded bounded cache and HTTP response caching plugin for Hyperlane with TTL/byte-budget eviction, single-flight stampede coalescing, pluggable CacheStore traits, and RFC Cache-Control/Age/X-Cache support.

Structs§

CacheConfig
Configuration for ShardedMemoryCache and CachePlugin.
CachePlugin
Process-wide CachePlugin singleton storing CacheConfig and a pluggable CacheStore.
CacheRequestHook
Opt-in request middleware serving cached GET/HEAD responses with X-Cache: HIT and Age.
CacheResponseHook
Opt-in response middleware storing eligible 200 OK responses according to Cache-Control and Vary.
CachedValue
Cached HTTP response or arbitrary byte payload with headers and timestamp metadata.
ShardedMemoryCache
High-concurrency 64-way sharded bounded in-memory CacheStore with single-flight coalescing.

Constants§

DEFAULT_CACHE_MAX_BYTES
Default maximum total cached byte budget (64 MiB).
DEFAULT_CACHE_MAX_ENTRIES
Default maximum cached response count across all shards.
DEFAULT_CACHE_MAX_ENTRY_BYTES
Default maximum single response body eligible for HTTP response caching (1 MiB).
DEFAULT_CACHE_TTL_MS
Default response cache TTL in milliseconds (60 seconds).
HEADER_X_CACHE
Diagnostic header indicating cache lookup outcome (HIT, MISS, or BYPASS).
X_CACHE_BYPASS
X-Cache value emitted when caching is bypassed by policy or headers.
X_CACHE_HIT
X-Cache value emitted when served directly from cache.
X_CACHE_MISS
X-Cache value emitted when computed by the origin handler.

Traits§

CacheStore
Pluggable asynchronous response/data cache store (in-memory, Redis, Memcached, etc.).

Type Aliases§

CacheFuture
Boxed Send future returned by async CacheStore trait methods.