pub struct Config { /* private fields */ }Expand description
The initial policy for a Pool.
The default is inert: no byte target and no idle expiry. Use
Self::with_capacity and Self::with_expiry before creating the pool.
Implementations§
Source§impl Config
impl Config
Sourcepub fn with_capacity(self, capacity: impl Into<Option<u64>>) -> Self
pub fn with_capacity(self, capacity: impl Into<Option<u64>>) -> Self
Set the initial byte target. None leaves it unbounded.
Sourcepub fn with_expiry(self, expiry: impl Into<Option<Duration>>) -> Self
pub fn with_expiry(self, expiry: impl Into<Option<Duration>>) -> Self
Set the wall-clock LRU window. None disables idle reclamation.
A non-latest cached group that nobody reads or writes for this long is
reclaimed, surfacing to any remaining reader as
Error::Old. This is independent of track retention:
max_age uses media timestamps, while this
window keeps idle content from pinning memory. Reclaiming without a write behind
it needs Pool::gc called periodically (origins do this automatically).
The value is fixed when the
pool is created. Values are rounded up to the pool’s 100 ms clock tick, with
100 ms as the minimum effective window.