Struct Memcached

Source
pub struct Memcached { /* private fields */ }

Implementations§

Source§

impl Memcached

Source

pub fn new<R, W>(read: R, write: W) -> Self
where R: AsyncRead + Send + Sync + Unpin + 'static, W: AsyncWrite + Send + Sync + Unpin + 'static,

Source

pub async fn stats(&mut self) -> Result<Stats, MtopError>

Get a Stats object with the current values of the interesting stats for the server.

Source

pub async fn slabs(&mut self) -> Result<Slabs, MtopError>

Get a Slabs object with information about each set of Slabs 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.

Source

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.

Source

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.

Source

pub async fn ping(&mut self) -> Result<(), MtopError>

Send a simple command to verify our connection to the server is working.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn set<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
where V: AsRef<[u8]>,

Store the provided item in the cache, regardless of whether it already exists.

Source

pub async fn add<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
where V: AsRef<[u8]>,

Store the provided item in the cache only if it does not already exist.

Source

pub async fn replace<V>( &mut self, key: &Key, flags: u64, ttl: u32, data: V, ) -> Result<(), MtopError>
where V: AsRef<[u8]>,

Store the provided item in the cache only if it already exists.

Source

pub async fn touch(&mut self, key: &Key, ttl: u32) -> Result<(), MtopError>

Update the TTL of an item in the cache if it exists, return an error otherwise.

Source

pub async fn delete(&mut self, key: &Key) -> Result<(), MtopError>

Delete an item in the cache if it exists, return an error otherwise.

Trait Implementations§

Source§

impl ClientFactory<Server, Memcached> for TcpClientFactory

Source§

async fn make(&self, server: &Server) -> Result<Memcached, MtopError>

Create a new client instance based on its ID.
Source§

impl Debug for Memcached

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more