pub struct AdaptiveCacheConfig {
pub max_size: usize,
pub default_ttl: Duration,
pub min_ttl: Duration,
pub max_ttl: Duration,
pub hot_threshold: usize,
pub cold_threshold: usize,
pub adaptation_rate: f64,
pub window_size: usize,
pub cleanup_interval_secs: u64,
pub enable_background_cleanup: bool,
}Expand description
Configuration for adaptive TTL cache
Fields§
§max_size: usizeMaximum number of items in cache
default_ttl: DurationDefault TTL when entry is first created
min_ttl: DurationMinimum TTL that entries can be reduced to
max_ttl: DurationMaximum TTL that entries can be increased to
hot_threshold: usizeAccess count threshold above which an item is considered “hot”
cold_threshold: usizeAccess count threshold below which an item is considered “cold”
adaptation_rate: f64How fast TTL adapts (0.0 = no adaptation, 1.0 = instant change)
window_size: usizeNumber of accesses to track per entry in sliding window
cleanup_interval_secs: u64Background cleanup interval in seconds
enable_background_cleanup: boolEnable background cleanup task
Trait Implementations§
Source§impl Clone for AdaptiveCacheConfig
impl Clone for AdaptiveCacheConfig
Source§fn clone(&self) -> AdaptiveCacheConfig
fn clone(&self) -> AdaptiveCacheConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AdaptiveCacheConfig
impl Debug for AdaptiveCacheConfig
Source§impl Default for AdaptiveCacheConfig
impl Default for AdaptiveCacheConfig
Source§impl From<AdaptiveCacheConfig> for AdaptiveCacheAdapter
impl From<AdaptiveCacheConfig> for AdaptiveCacheAdapter
Source§fn from(config: AdaptiveCacheConfig) -> Self
fn from(config: AdaptiveCacheConfig) -> Self
Converts to this type from the input type.
Source§impl From<AdaptiveCacheConfig> for CacheConfig
Conversion from AdaptiveCacheConfig to standard CacheConfig
impl From<AdaptiveCacheConfig> for CacheConfig
Conversion from AdaptiveCacheConfig to standard CacheConfig
Source§fn from(config: AdaptiveCacheConfig) -> Self
fn from(config: AdaptiveCacheConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AdaptiveCacheConfig
impl RefUnwindSafe for AdaptiveCacheConfig
impl Send for AdaptiveCacheConfig
impl Sync for AdaptiveCacheConfig
impl Unpin for AdaptiveCacheConfig
impl UnsafeUnpin for AdaptiveCacheConfig
impl UnwindSafe for AdaptiveCacheConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.