pub struct DashmapCache { /* private fields */ }
Implementations§
Source§impl<'a> DashmapCache
impl<'a> DashmapCache
pub fn new() -> Self
Sourcepub fn refresh_cache<F, A, V>(
&self,
invalidate_keys: &Vec<String>,
closure: F,
arg: A,
) -> Result<V, CacheError>
pub fn refresh_cache<F, A, V>( &self, invalidate_keys: &Vec<String>, closure: F, arg: A, ) -> Result<V, CacheError>
Atomic operation to replace a cached entry by a new computation value
Sourcepub fn cached<F, A, V>(
&self,
invalidate_keys: &Vec<String>,
closure: F,
arg: A,
) -> Result<V, CacheError>
pub fn cached<F, A, V>( &self, invalidate_keys: &Vec<String>, closure: F, arg: A, ) -> Result<V, CacheError>
Computes a signature for arg If already present in the cache, returns directly associated return value Otherwise, compute a new return value and fills the cache with it It is recommended to use a call enum and dispatch in the same closure for the same cache if the input types or values are susceptible to overlap.
Sourcepub async fn async_cached<F, A, V>(
&self,
invalidate_keys: &Vec<String>,
closure: F,
arg: A,
) -> Result<V, CacheError>
pub async fn async_cached<F, A, V>( &self, invalidate_keys: &Vec<String>, closure: F, arg: A, ) -> Result<V, CacheError>
Async version of cached()
pub fn invalidate(&self, tag: &str)
Trait Implementations§
Source§impl Clone for DashmapCache
impl Clone for DashmapCache
Source§fn clone(&self) -> DashmapCache
fn clone(&self) -> DashmapCache
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for DashmapCache
impl !RefUnwindSafe for DashmapCache
impl Send for DashmapCache
impl Sync for DashmapCache
impl Unpin for DashmapCache
impl UnwindSafe for DashmapCache
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