Struct cacher_rs::AsyncCacher
source · [−]pub struct AsyncCacher<T> { /* private fields */ }
Implementations
sourceimpl<T> Cacher<T>
impl<T> Cacher<T>
pub fn new() -> Self
pub async fn fetch(
&mut self,
key: &str,
expires_in_secs: u64,
calculation: impl Fn() -> Pin<Box<dyn Future<Output = Result<T>>>> + 'static
) -> Result<&T>
pub async fn force_fetch(
&mut self,
key: &str,
expires_in_secs: u64,
calculation: impl Fn() -> Pin<Box<dyn Future<Output = Result<T>>>> + 'static
) -> Result<&T>
pub async fn read(&mut self, key: &str) -> Result<&T>
pub fn write(&mut self, key: &str, value: T) -> Result<()>
pub fn expire(&mut self, key: &str) -> Result<()>
pub fn delete(&mut self, key: &str) -> Option<Cache<T>>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Cacher<T>
impl<T> !Send for Cacher<T>
impl<T> !Sync for Cacher<T>
impl<T> Unpin for Cacher<T> where
T: Unpin,
impl<T> !UnwindSafe for Cacher<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more