pub struct FrequencyBasedPolicy { /* private fields */ }Expand description
Frequency-based tiering policy
Implementations§
Source§impl FrequencyBasedPolicy
impl FrequencyBasedPolicy
Sourcepub fn new(
tiers: Vec<TierInfo>,
promotion_threshold: f64,
demotion_threshold: f64,
) -> Self
pub fn new( tiers: Vec<TierInfo>, promotion_threshold: f64, demotion_threshold: f64, ) -> Self
Create new frequency-based policy
Sourcepub async fn record_access(&self, key: CacheKey, tier: usize, size: usize)
pub async fn record_access(&self, key: CacheKey, tier: usize, size: usize)
Record access
Sourcepub async fn evaluate(&self, key: &CacheKey) -> Result<TieringAction>
pub async fn evaluate(&self, key: &CacheKey) -> Result<TieringAction>
Evaluate tiering action for a key
Auto Trait Implementations§
impl Freeze for FrequencyBasedPolicy
impl !RefUnwindSafe for FrequencyBasedPolicy
impl Send for FrequencyBasedPolicy
impl Sync for FrequencyBasedPolicy
impl Unpin for FrequencyBasedPolicy
impl UnsafeUnpin for FrequencyBasedPolicy
impl !UnwindSafe for FrequencyBasedPolicy
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> 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 more