pub struct Memcached { /* private fields */ }
Implementations§
Source§impl Memcached
impl Memcached
pub fn new<R, W>(read: R, write: W) -> Self
Sourcepub async fn stats(&mut self) -> Result<Stats, MtopError>
pub async fn stats(&mut self) -> Result<Stats, MtopError>
Get a Stats
object with the current values of the interesting stats for the server.
Sourcepub async fn slabs(&mut self) -> Result<Slabs, MtopError>
pub async fn slabs(&mut self) -> Result<Slabs, MtopError>
Get a Slabs
object with information about each set of Slab
s maintained by
the Memcached server. You can think of each Slab
as a class of objects that
are stored together in memory. Note that Slab
IDs may not be contiguous based
on the size of items actually stored by the server.
Sourcepub async fn items(&mut self) -> Result<SlabItems, MtopError>
pub async fn items(&mut self) -> Result<SlabItems, MtopError>
Get a SlabsItems
object with information about the SlabItem
items stored in
each slab class maintained by the Memcached server. The ID of each SlabItem
corresponds to a Slab
maintained by the server. Note that SlabItem
IDs may
not be contiguous based on the size of items actually stored by the server.
Sourcepub async fn metas(&mut self) -> Result<Vec<Meta>, MtopError>
pub async fn metas(&mut self) -> Result<Vec<Meta>, MtopError>
Get a Meta
object for every item in the cache which includes its key and expiration
time as a UNIX timestamp. Expiration time will be -1
if the item was set with an
infinite TTL.
Sourcepub async fn ping(&mut self) -> Result<(), MtopError>
pub async fn ping(&mut self) -> Result<(), MtopError>
Send a simple command to verify our connection to the server is working.
Sourcepub async fn flush_all(
&mut self,
wait: Option<Duration>,
) -> Result<(), MtopError>
pub async fn flush_all( &mut self, wait: Option<Duration>, ) -> Result<(), MtopError>
Flush all entries in the cache, optionally after a delay. When a delay is used, the server will flush entries after a delay but the call will still return immediately.
Sourcepub async fn get(
&mut self,
keys: &[Key],
) -> Result<HashMap<String, Value>, MtopError>
pub async fn get( &mut self, keys: &[Key], ) -> Result<HashMap<String, Value>, MtopError>
Get a map of the requested keys and their corresponding Value
in the cache
including the key, flags, and data.
Sourcepub async fn incr(&mut self, key: &Key, delta: u64) -> Result<u64, MtopError>
pub async fn incr(&mut self, key: &Key, delta: u64) -> Result<u64, MtopError>
Increment the value of a key by the given delta if the value is numeric returning the new value. Returns an error if the value is not numeric.
Sourcepub async fn decr(&mut self, key: &Key, delta: u64) -> Result<u64, MtopError>
pub async fn decr(&mut self, key: &Key, delta: u64) -> Result<u64, MtopError>
Decrement the value of a key by the given delta if the value is numeric returning the new value with a minimum of 0. Returns an error if the value is not numeric.
Sourcepub async fn set<V>(
&mut self,
key: &Key,
flags: u64,
ttl: u32,
data: V,
) -> Result<(), MtopError>
pub async fn set<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
Store the provided item in the cache, regardless of whether it already exists.
Sourcepub async fn add<V>(
&mut self,
key: &Key,
flags: u64,
ttl: u32,
data: V,
) -> Result<(), MtopError>
pub async fn add<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
Store the provided item in the cache only if it does not already exist.
Sourcepub async fn replace<V>(
&mut self,
key: &Key,
flags: u64,
ttl: u32,
data: V,
) -> Result<(), MtopError>
pub async fn replace<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
Store the provided item in the cache only if it already exists.