Expand description
Reusable bounded in-memory collections for Chio serving processes.
Core invariant: no long-lived collection in a serving process may exist
without (1) a capacity policy (ring, LRU, idle-sweep, or deny-at-cap) and
(2) a live size metric. This crate is the substrate: Ring and BoundedMap
each own a cloneable SizeGauge.
Structs§
- Bounded
Map - Capacity-bounded, optionally TTL-swept map for caches and rate-limit tables.
Eviction order is oldest-insert (approximate LRU: a re-insert of an existing
key moves it to newest;
getrefreshes the idle timestamp but does not reorder).insertreturns any (key, value) evicted for capacity so the caller can persist-before-drop.capacity == 0disables the cache, mirroringRing. - Ring
- Fixed-capacity append-only ring for process-local mirrors.
capacity == 0means “disabled” (stores nothing, hands each item straight back), the correct default when a durable store is authoritative. - Size
Gauge - Live entry-count gauge for a bounded structure. Cloneable handle so a telemetry exporter can read the count without locking the structure that owns it.