pub struct TinyRef { /* private fields */ }Expand description
cache with optional max age configuration
Implementations§
Source§impl TinyRef
impl TinyRef
Sourcepub fn get_cached_or_fetch<T, Fun>(
&self,
item_key: impl ToString,
fetch_with: Fun,
) -> T
pub fn get_cached_or_fetch<T, Fun>( &self, item_key: impl ToString, fetch_with: Fun, ) -> T
get cached item from cache or use fun to resolve the item
pub fn write<T>(&self, item_key: impl ToString, v: &T)
pub fn item_age(&self, item_key: impl ToString) -> Option<Duration>
pub fn read<T>(&self, item_key: impl ToString) -> Option<T>
pub fn invalidate(&self, item_key: impl ToString)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TinyRef
impl RefUnwindSafe for TinyRef
impl Send for TinyRef
impl Sync for TinyRef
impl Unpin for TinyRef
impl UnwindSafe for TinyRef
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