pub struct MemcachedBackend { /* private fields */ }Expand description
Memcached backend powered by rust-memcache.
Build with builder; the terminal
connect is async and verifies the
server is reachable (unlike RedisBackend’s lazy build-then-connect
split).
Implementations§
Source§impl MemcachedBackend
impl MemcachedBackend
Sourcepub fn builder() -> MemcachedBackendBuilder
pub fn builder() -> MemcachedBackendBuilder
Start building a MemcachedBackend.
Sourcepub async fn refresh_ttl(
&self,
key: &str,
ttl: Option<Duration>,
) -> Result<bool, BackendError>
pub async fn refresh_ttl( &self, key: &str, ttl: Option<Duration>, ) -> Result<bool, BackendError>
Refresh a key’s TTL via the memcached touch command.
Mirrors cachekit-py’s refresh_ttl: a bare method, not part of
TtlInspectable — memcached cannot
read TTLs, so the trait (which requires ttl()) cannot be
implemented, and TTL-refresh-on-read features will not auto-engage on
this backend in any SDK. None makes the entry permanent (py’s
refresh_ttl(key, 0)); TTLs clamp to the 30-day ceiling like
set.
Returns true if the key existed and its expiry was updated.
Trait Implementations§
Source§impl Backend for MemcachedBackend
impl Backend for MemcachedBackend
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the raw bytes stored under
key, or None if absent.Source§fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store
value under key, optionally expiring after ttl.Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return
true if key exists without fetching the value.Source§fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus, BackendError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return health/status information for this backend.
Source§fn as_lockable(&self) -> Option<&dyn LockableBackend>
fn as_lockable(&self) -> Option<&dyn LockableBackend>
Expose this backend’s
LockableBackend capability, if it has one. Read moreSource§fn attach_metrics(&self, _provider: MetricsProvider)
fn attach_metrics(&self, _provider: MetricsProvider)
Receive the client’s live hit/miss statistics. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for MemcachedBackend
impl !UnwindSafe for MemcachedBackend
impl Freeze for MemcachedBackend
impl Send for MemcachedBackend
impl Sync for MemcachedBackend
impl Unpin for MemcachedBackend
impl UnsafeUnpin for MemcachedBackend
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