pub struct MemcachedCache { /* private fields */ }Available on crate feature
memcached only.Expand description
Memcached distributed cache
This is an alternative L2 (warm tier) cache backend, providing:
- Distributed caching across multiple instances
- Simple key-value storage (no persistence)
- LRU eviction policy
- High throughput for read-heavy workloads
Note: Unlike Redis, Memcached does not support:
- TTL introspection (cannot get remaining TTL)
- Persistence to disk
- Advanced data structures
Implementations§
Trait Implementations§
Source§impl CacheBackend for MemcachedCache
Implement CacheBackend trait for MemcachedCache
impl CacheBackend for MemcachedCache
Implement CacheBackend trait for MemcachedCache
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 MemcachedCache
impl !RefUnwindSafe for MemcachedCache
impl Send for MemcachedCache
impl Sync for MemcachedCache
impl Unpin for MemcachedCache
impl UnsafeUnpin for MemcachedCache
impl !UnwindSafe for MemcachedCache
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