pub struct MemoryCache { /* private fields */ }Expand description
In-memory LRU cache store.
Enforces a maximum byte limit. When the limit is exceeded, the least recently accessed entries are evicted. Thread-safe via Mutex.
Implementations§
Source§impl MemoryCache
impl MemoryCache
Sourcepub fn current_bytes(&self) -> usize
pub fn current_bytes(&self) -> usize
Current memory usage in bytes.
Trait Implementations§
Source§impl CacheStore for MemoryCache
impl CacheStore for MemoryCache
fn get(&self, key: &CacheKey) -> Result<Option<Value>>
fn put(&self, key: &CacheKey, value: &Value) -> Result<()>
fn exists(&self, key: &CacheKey) -> Result<bool>
fn remove(&self, key: &CacheKey) -> Result<()>
fn metadata(&self, key: &CacheKey) -> Result<Option<EntryMeta>>
Auto Trait Implementations§
impl !Freeze for MemoryCache
impl RefUnwindSafe for MemoryCache
impl Send for MemoryCache
impl Sync for MemoryCache
impl Unpin for MemoryCache
impl UnsafeUnpin for MemoryCache
impl UnwindSafe for MemoryCache
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