pub struct Pool { /* private fields */ }Expand description
A shared byte budget that caches charge into; cloning shares the same budget.
The pool tracks how many payload bytes are cached across every registered group
and evicts the least-recently-read groups once used exceeds capacity.
Eviction aborts the victim group with Error::Evicted,
which frees its frames immediately and wakes any parked readers. Pinned (latest)
groups are never evicted but still count against the budget.
Reads and writes only touch atomics; the internal lock is taken when a group registers/unregisters and when the pool is actually over budget.
Implementations§
Source§impl Pool
impl Pool
Sourcepub fn new(capacity: u64) -> Self
pub fn new(capacity: u64) -> Self
Create a pool that evicts once capacity bytes are cached.
The budget counts frame payload bytes (plus a small fixed overhead per group), not process RSS; leave headroom when sizing it from real memory.
Sourcepub fn capacity(&self) -> Option<u64>
pub fn capacity(&self) -> Option<u64>
The configured capacity in bytes, or None when unbounded.