pub struct TwoLevelCacheStore<L1, L2> { /* private fields */ }Expand description
Cache store that composes a fast L1 store with an authoritative L2 store.
Implementations§
Source§impl<L1, L2> TwoLevelCacheStore<L1, L2>
impl<L1, L2> TwoLevelCacheStore<L1, L2>
Sourcepub fn with_l1_backfill_ttl(self, ttl: Option<Duration>) -> Self
pub fn with_l1_backfill_ttl(self, ttl: Option<Duration>) -> Self
Sets the TTL used when an L2 hit is backfilled into L1.
Sourcepub fn with_metrics(self, metrics: MetricsRegistry) -> Self
pub fn with_metrics(self, metrics: MetricsRegistry) -> Self
Attaches a metrics registry to this two-level cache store.
Sourcepub fn stats(&self) -> TwoLevelCacheStats
pub fn stats(&self) -> TwoLevelCacheStats
Returns shared two-level cache counters.
Trait Implementations§
Source§impl<L1, L2> CacheStore for TwoLevelCacheStore<L1, L2>where
L1: CacheStore,
L2: CacheStore,
impl<L1, L2> CacheStore for TwoLevelCacheStore<L1, L2>where
L1: CacheStore,
L2: CacheStore,
Source§fn get_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads a raw value by key.
Source§fn set_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes a raw value with optional TTL.
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes a value by key.
Source§fn delete_many<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [CacheKey],
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_many<'life0, 'life1, 'async_trait>(
&'life0 self,
keys: &'life1 [CacheKey],
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes multiple values by key. Read more
Source§fn get_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<T>>> + Send + 'async_trait>>where
T: DeserializeOwned + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_json<'life0, 'life1, 'async_trait, T>(
&'life0 self,
key: &'life1 CacheKey,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<T>>> + Send + 'async_trait>>where
T: DeserializeOwned + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads a JSON value by key.
Auto Trait Implementations§
impl<L1, L2> Freeze for TwoLevelCacheStore<L1, L2>
impl<L1, L2> !RefUnwindSafe for TwoLevelCacheStore<L1, L2>
impl<L1, L2> Send for TwoLevelCacheStore<L1, L2>
impl<L1, L2> Sync for TwoLevelCacheStore<L1, L2>
impl<L1, L2> Unpin for TwoLevelCacheStore<L1, L2>
impl<L1, L2> UnsafeUnpin for TwoLevelCacheStore<L1, L2>where
L1: UnsafeUnpin,
L2: UnsafeUnpin,
impl<L1, L2> !UnwindSafe for TwoLevelCacheStore<L1, L2>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request