pub struct Cache { /* private fields */ }Implementations§
Source§impl Cache
impl Cache
pub fn new(config: CacheConfig) -> Result<Self, Box<dyn Error>>
pub fn get_key_lock(&self, key: &str) -> Arc<Mutex<()>>
pub fn set<V: Serialize>( &self, key: &str, value: V, ttl: Duration, ) -> Result<(), Box<dyn Error>>
pub fn set_without_guard<V: Serialize>( &self, key: &str, value: V, ttl: Duration, ) -> Result<(), Box<dyn Error>>
pub fn get<V: for<'de> Deserialize<'de>>(&self, key: &str) -> Option<V>
pub fn expire(&self, key: &str) -> Option<Duration>
pub fn remove(&self, key: &str) -> Result<(), Box<dyn Error>>
pub fn remove_without_guard(&self, key: &str) -> Result<(), Box<dyn Error>>
pub fn clear(&self) -> Result<(), Box<dyn Error>>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
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