pub struct ForecastCache { /* private fields */ }Expand description
Cache of materialized forecasts.
Implementations§
Source§impl ForecastCache
impl ForecastCache
Sourcepub fn with_max_entries(self, max: usize) -> Self
pub fn with_max_entries(self, max: usize) -> Self
Create a cache with a custom capacity limit.
Sourcepub fn store(
&self,
measurement: &str,
tags: &BTreeMap<String, String>,
result: ForecastResult,
horizon: usize,
)
pub fn store( &self, measurement: &str, tags: &BTreeMap<String, String>, result: ForecastResult, horizon: usize, )
Store a materialized forecast.
Sourcepub fn get(
&self,
measurement: &str,
tags: &BTreeMap<String, String>,
) -> Option<MaterializedForecast>
pub fn get( &self, measurement: &str, tags: &BTreeMap<String, String>, ) -> Option<MaterializedForecast>
Look up a cached forecast, returning it if fresh.
Sourcepub fn get_any(
&self,
measurement: &str,
tags: &BTreeMap<String, String>,
) -> Option<MaterializedForecast>
pub fn get_any( &self, measurement: &str, tags: &BTreeMap<String, String>, ) -> Option<MaterializedForecast>
Get a cached forecast regardless of freshness.
Sourcepub fn evict_stale(&self) -> usize
pub fn evict_stale(&self) -> usize
Remove all stale entries.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ForecastCache
impl Freeze for ForecastCache
impl Send for ForecastCache
impl Sync for ForecastCache
impl Unpin for ForecastCache
impl UnsafeUnpin for ForecastCache
impl UnwindSafe for ForecastCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more