pub struct MapCache { /* private fields */ }Expand description
In-memory map cache (SPEC §5.6, §11).
Implementations§
Source§impl MapCache
impl MapCache
Sourcepub fn should_use_cache(&self, mode: RefreshMode, force_refresh: bool) -> bool
pub fn should_use_cache(&self, mode: RefreshMode, force_refresh: bool) -> bool
Check if cache should be used based on mode and flags.
Returns true if a cache lookup should be attempted.
Sourcepub fn get(
&self,
key: &MapCacheKey,
mode: RefreshMode,
force_refresh: bool,
) -> Option<&String>
pub fn get( &self, key: &MapCacheKey, mode: RefreshMode, force_refresh: bool, ) -> Option<&String>
Get a cached map.
For Manual mode, use get_last_map instead.
Sourcepub fn get_last_map(&self) -> Option<&String>
pub fn get_last_map(&self) -> Option<&String>
Get the last computed map (for Manual mode).
Sourcepub fn set(&mut self, key: MapCacheKey, value: String, duration: Duration)
pub fn set(&mut self, key: MapCacheKey, value: String, duration: Duration)
Store a computed map.
Per SPEC §11: always writes to both keyed cache and last_map, regardless of mode or force_refresh.
Sourcepub fn last_duration(&self) -> Duration
pub fn last_duration(&self) -> Duration
Get the duration of the last computation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MapCache
impl RefUnwindSafe for MapCache
impl Send for MapCache
impl Sync for MapCache
impl Unpin for MapCache
impl UnsafeUnpin for MapCache
impl UnwindSafe for MapCache
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