Struct pond_cache::Cache
source · pub struct Cache<T> { /* private fields */ }Implementations§
source§impl<T: Serialize + DeserializeOwned + Clone> Cache<T>
impl<T: Serialize + DeserializeOwned + Clone> Cache<T>
pub fn new(path: PathBuf) -> Result<Self, Error>
pub fn with_time_to_live(path: PathBuf, ttl: Duration) -> Result<Self, Error>
pub fn get<K>(&self, key: K) -> Result<Option<T>, Error>where
K: Hash,
pub fn store<K: Hash>(&self, key: K, value: T) -> Result<(), Error>
pub fn store_with_expiration<K: Hash>( &self, key: K, value: T, expiration: DateTime<Utc> ) -> Result<(), Error>
pub fn clean(&self) -> Result<(), Error>
Auto Trait Implementations§
impl<T> Freeze for Cache<T>
impl<T> RefUnwindSafe for Cache<T>where
T: RefUnwindSafe,
impl<T> Send for Cache<T>where
T: Send,
impl<T> Sync for Cache<T>where
T: Sync,
impl<T> Unpin for Cache<T>where
T: Unpin,
impl<T> UnwindSafe for Cache<T>where
T: UnwindSafe,
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