pub struct AsyncCache { /* private fields */ }Expand description
Handle to a cache database.
Implementations§
Source§impl AsyncCache
impl AsyncCache
Sourcepub async fn new(kind: CacheKind) -> Result<Self, CacheError>
pub async fn new(kind: CacheKind) -> Result<Self, CacheError>
Create new cache handle of a given kind.
Trait Implementations§
Source§impl CacheRaw for AsyncCache
impl CacheRaw for AsyncCache
Source§fn get_field<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_field<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves a
field’s value from the cache.Source§fn get_fields<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<u8>>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_fields<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<u8>>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves all fields and their values for a given
key from the cache.Source§fn insert_field<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn insert_field<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
value: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Adds a
field with given value to the cache.
Returns true if an element was added,false if it existed before and was updated.Source§fn field_exists<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn field_exists<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Checks if a specific
field exists in the cache.Source§fn delete_field<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_field<'life0, 'life1, 'async_trait>(
&'life0 mut self,
field: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes
field from the cache. Returns true if that entry existed.Source§impl Clone for AsyncCache
impl Clone for AsyncCache
Source§fn clone(&self) -> AsyncCache
fn clone(&self) -> AsyncCache
Returns a duplicate 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 AsyncCache
impl RefUnwindSafe for AsyncCache
impl Send for AsyncCache
impl Sync for AsyncCache
impl Unpin for AsyncCache
impl UnwindSafe for AsyncCache
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