pub struct Cache { /* private fields */ }
Expand description
Primary cache abstraction.
Can be cheaply cloned and namespaced.
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn delete_with_ns<N, K>(&self, ns: Option<&N>, key: &K) -> Result<(), Error>
pub fn delete_with_ns<N, K>(&self, ns: Option<&N>, key: &K) -> Result<(), Error>
Delete the given key from the specified namespace.
Sourcepub fn namespaced<N>(&self, ns: &N) -> Result<Self, Error>where
N: Serialize,
pub fn namespaced<N>(&self, ns: &N) -> Result<Self, Error>where
N: Serialize,
Create a namespaced cache.
The namespace must be unique to avoid conflicts.
Each call to this functions will return its own queue for resolving futures.
Sourcepub fn insert<K, T>(
&self,
key: K,
age: Duration,
value: &T,
) -> Result<(), Error>
pub fn insert<K, T>( &self, key: K, age: Duration, value: &T, ) -> Result<(), Error>
Insert a value into the cache.
Sourcepub fn test<K>(&self, key: K) -> Result<State<()>, Error>where
K: Serialize,
pub fn test<K>(&self, key: K) -> Result<State<()>, Error>where
K: Serialize,
Test an entry from the cache.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl !RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl !UnwindSafe for Cache
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