pub struct QuickCacheBackend { /* private fields */ }Available on crate feature
quick_cache only.Expand description
QuickCache in-memory cache with per-key TTL support
This is an alternative L1 (hot tier) cache backend optimized for maximum performance:
- Extremely fast in-memory access (sub-microsecond latency)
- Automatic eviction via LRU
- Per-key TTL support
- Minimal memory overhead
- Lock-free design for concurrent access
When to use QuickCache vs Moka:
- Use
QuickCachewhen you need maximum throughput and minimal latency - Use Moka when you need advanced features like time-to-idle or weight-based eviction
Implementations§
Trait Implementations§
Source§impl CacheBackend for QuickCacheBackend
Implement CacheBackend trait for QuickCacheBackend
impl CacheBackend for QuickCacheBackend
Implement CacheBackend trait for QuickCacheBackend
Source§fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
Get value from cache by key Read more
Source§fn set_with_ttl<'a>(
&'a self,
key: &'a str,
value: Bytes,
ttl: Duration,
) -> BoxFuture<'a, CacheResult<()>>
fn set_with_ttl<'a>( &'a self, key: &'a str, value: Bytes, ttl: Duration, ) -> BoxFuture<'a, CacheResult<()>>
Set value in cache with time-to-live Read more
Source§fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, CacheResult<()>>
fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, CacheResult<()>>
Remove value from cache Read more
Source§fn set<'a>(
&'a self,
key: &'a str,
value: Bytes,
) -> BoxFuture<'a, CacheResult<()>>
fn set<'a>( &'a self, key: &'a str, value: Bytes, ) -> BoxFuture<'a, CacheResult<()>>
Set value in cache with default TTL (5 minutes)
Source§fn remove_pattern<'a>(
&'a self,
_pattern: &'a str,
) -> BoxFuture<'a, CacheResult<()>>
fn remove_pattern<'a>( &'a self, _pattern: &'a str, ) -> BoxFuture<'a, CacheResult<()>>
Remove keys matching a pattern Read more
Auto Trait Implementations§
impl Freeze for QuickCacheBackend
impl !RefUnwindSafe for QuickCacheBackend
impl Send for QuickCacheBackend
impl Sync for QuickCacheBackend
impl Unpin for QuickCacheBackend
impl UnsafeUnpin for QuickCacheBackend
impl !UnwindSafe for QuickCacheBackend
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