pub struct AdaptiveConfig {
pub target_hit_rate: f64,
pub tolerance: f64,
pub adjustment_interval: u64,
pub min_capacity: usize,
pub max_capacity: usize,
pub growth_factor: f64,
pub shrink_factor: f64,
pub ttl_extension: Duration,
pub ttl_reduction: Duration,
pub window_size: usize,
}Expand description
Configuration for AdaptivePolicy.
Fields§
§target_hit_rate: f64Desired cache hit rate as a fraction in (0.0, 1.0].
tolerance: f64Half-width of the “good enough” band around target_hit_rate.
If the observed rate is within [target - tolerance, target + tolerance]
no adjustment is made.
adjustment_interval: u64Number of operations between adjustment evaluations.
min_capacity: usizeMinimum cache capacity the policy will ever recommend.
max_capacity: usizeMaximum cache capacity the policy will ever recommend.
growth_factor: f64Multiplicative factor for capacity growth (e.g. 1.5 → +50%).
shrink_factor: f64Multiplicative factor for capacity shrink (e.g. 0.75 → −25%).
ttl_extension: DurationDuration added to TTL when the cache is under-performing.
ttl_reduction: DurationDuration removed from TTL when the cache is over-provisioned.
window_size: usizeNumber of recent observations kept in the rolling window.
Implementations§
Source§impl AdaptiveConfig
impl AdaptiveConfig
Sourcepub fn validate(&self) -> Result<(), AdaptiveError>
pub fn validate(&self) -> Result<(), AdaptiveError>
Validate the configuration, returning an error if any field is out of range.
Trait Implementations§
Source§impl Clone for AdaptiveConfig
impl Clone for AdaptiveConfig
Source§fn clone(&self) -> AdaptiveConfig
fn clone(&self) -> AdaptiveConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more