pub struct DataCache { /* private fields */ }Expand description
LRU cache for data sources
Implementations§
Source§impl DataCache
impl DataCache
Sourcepub fn get(&self, key: &str) -> Option<DataSource>
pub fn get(&self, key: &str) -> Option<DataSource>
Get from cache
Sourcepub fn insert(&self, key: String, data: DataSource)
pub fn insert(&self, key: String, data: DataSource)
Insert into cache
Sourcepub fn insert_with_ttl(&self, key: String, data: DataSource, ttl: Duration)
pub fn insert_with_ttl(&self, key: String, data: DataSource, ttl: Duration)
Insert with custom TTL
Sourcepub fn remove(&self, key: &str) -> Option<DataSource>
pub fn remove(&self, key: &str) -> Option<DataSource>
Remove from cache
Sourcepub fn stats(&self) -> &CacheStats
pub fn stats(&self) -> &CacheStats
Get cache statistics
Auto Trait Implementations§
impl !Freeze for DataCache
impl !RefUnwindSafe for DataCache
impl Send for DataCache
impl Sync for DataCache
impl Unpin for DataCache
impl UnsafeUnpin for DataCache
impl UnwindSafe for DataCache
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