pub struct MemoryStore { /* private fields */ }Expand description
A thread-safe in-memory cache store backed by DashMap.
Implementations§
Source§impl MemoryStore
impl MemoryStore
Sourcepub fn read_with_options(
&self,
key: &str,
options: &CacheOptions,
) -> Option<Value>
pub fn read_with_options( &self, key: &str, options: &CacheOptions, ) -> Option<Value>
Reads a cached value using explicit options such as version matching.
Sourcepub fn exist_with_options(&self, key: &str, options: &CacheOptions) -> bool
pub fn exist_with_options(&self, key: &str, options: &CacheOptions) -> bool
Returns true when a live entry exists for key under the given options.
Trait Implementations§
Source§impl CacheStore for MemoryStore
impl CacheStore for MemoryStore
Source§fn write(&self, key: &str, value: Value, options: CacheOptions)
fn write(&self, key: &str, value: Value, options: CacheOptions)
Writes a value under
key with the given options.Source§fn fetch(
&self,
key: &str,
options: CacheOptions,
f: impl FnOnce() -> Value,
) -> Value
fn fetch( &self, key: &str, options: CacheOptions, f: impl FnOnce() -> Value, ) -> Value
Reads a cached value or computes and stores it on a miss.
Source§fn increment(&self, key: &str, amount: i64) -> Option<i64>
fn increment(&self, key: &str, amount: i64) -> Option<i64>
Increments an integer entry by
amount.Source§fn decrement(&self, key: &str, amount: i64) -> Option<i64>
fn decrement(&self, key: &str, amount: i64) -> Option<i64>
Decrements an integer entry by
amount.Source§fn read_multi(&self, keys: &[&str]) -> HashMap<String, Value>
fn read_multi(&self, keys: &[&str]) -> HashMap<String, Value>
Reads many keys at once, omitting misses.
Source§fn write_multi(&self, entries: HashMap<String, Value>, options: CacheOptions)
fn write_multi(&self, entries: HashMap<String, Value>, options: CacheOptions)
Writes many key/value pairs with shared options.
Source§impl Debug for MemoryStore
impl Debug for MemoryStore
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryStore
impl !RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
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> 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 more