Skip to main content

Module foyer_cache

Module foyer_cache 

Source
Expand description

Hybrid memory + disk cache backend.

Opt-in alternative to nvme_cache::NvmeHotCache. Selected at runtime via WMBT_KV_PUFFER_BACKEND=hybrid. The cache manages both memory and on-disk tiers internally:

  • S3-FIFO eviction in memory
  • Direct I/O on Linux to bypass the OS page cache
  • io_uring async backend (when available) for the disk tier
  • Block-aligned device layout

sync get fast path probes the memory tier directly to avoid a block_on round trip on warm hits, which is where the production perf wins live. Foyer hybrid cache: in-process RAM (L0) + on-disk SSD (L1).

Structs§

FoyerCacheConfig
Tuning knobs for the hybrid cache.
FoyerHybridCache
Hybrid memory + disk cache backed by foyer.

Enums§

FoyerCacheError
Cache operation failures surfaced to callers.
FoyerHitTier
Which foyer tier served a hit. Returned alongside the payload by FoyerCache::get_with_tier so callers can attribute latency to the right tier in observability traces.

Functions§

backend_selected
Returns true when WMBT_KV_PUFFER_BACKEND=hybrid in the process environment.
backend_selected_with
Returns true when the supplied lookup yields hybrid for WMBT_KV_PUFFER_BACKEND.
config_from_env
Read FoyerCacheConfig from process environment variables.
config_from_lookup
Read FoyerCacheConfig from a key/value lookup. Tested in isolation from process env so callers can drive deterministic unit tests without mutating global state.