pub struct MultiTierCache { /* private fields */ }Expand description
Multi-tier cache
Implementations§
Source§impl MultiTierCache
impl MultiTierCache
Sourcepub async fn new(config: CacheConfig) -> Result<Self>
pub async fn new(config: CacheConfig) -> Result<Self>
Create new multi-tier cache
Sourcepub async fn get(&self, key: &CacheKey) -> Result<Option<CacheValue>>
pub async fn get(&self, key: &CacheKey) -> Result<Option<CacheValue>>
Get value from cache (checks all tiers)
Sourcepub async fn put(&self, key: CacheKey, value: CacheValue) -> Result<()>
pub async fn put(&self, key: CacheKey, value: CacheValue) -> Result<()>
Put value into cache (writes to all tiers)
Sourcepub async fn stats(&self) -> CacheStats
pub async fn stats(&self) -> CacheStats
Get global statistics
Sourcepub async fn tier_stats(&self) -> HashMap<String, CacheStats>
pub async fn tier_stats(&self) -> HashMap<String, CacheStats>
Get per-tier statistics
Auto Trait Implementations§
impl Freeze for MultiTierCache
impl !RefUnwindSafe for MultiTierCache
impl Send for MultiTierCache
impl Sync for MultiTierCache
impl Unpin for MultiTierCache
impl UnsafeUnpin for MultiTierCache
impl !UnwindSafe for MultiTierCache
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more