[−][src]Struct async_memcached::Client
High-level memcached client.
Client
is mapped one-to-one with a given connection to a memcached server, and provides a
high-level API for executing commands on that connection.
Implementations
impl Client
[src]
pub async fn new<S: AsRef<str>>(dsn: S) -> Result<Client, Error>
[src]
Creates a new Client
based on the given data source string.
Currently only supports TCP connections, and as such, the DSN should be in the format of
<host of IP>:<port>
.
pub async fn get<K: AsRef<[u8]>, '_>(
&'_ mut self,
key: K
) -> Result<Option<Value>, Error>
[src]
&'_ mut self,
key: K
) -> Result<Option<Value>, Error>
Gets the given key.
If the key is found, Some(Value)
is returned, describing the metadata and data of the key.
Otherwise, Error
is returned.
pub async fn get_many<I, K, '_>(
&'_ mut self,
keys: I
) -> Result<Vec<Value>, Error> where
I: IntoIterator<Item = K>,
K: AsRef<[u8]>,
[src]
&'_ mut self,
keys: I
) -> Result<Vec<Value>, Error> where
I: IntoIterator<Item = K>,
K: AsRef<[u8]>,
Gets the given keys.
If any of the keys are found, a vector of Value
will be returned, where Value
describes the metadata and data of the key.
Otherwise, Error
is returned.
pub async fn set<K, V, '_>(
&'_ mut self,
key: K,
value: V,
ttl: Option<i64>,
flags: Option<u32>
) -> Result<(), Error> where
K: AsRef<[u8]>,
V: AsRef<[u8]>,
[src]
&'_ mut self,
key: K,
value: V,
ttl: Option<i64>,
flags: Option<u32>
) -> Result<(), Error> where
K: AsRef<[u8]>,
V: AsRef<[u8]>,
Sets the given key.
If ttl
or flags
are not specified, they will default to 0. If the value is set
successfully, ()
is returned, otherwise Error
is returned.
pub async fn version<'_>(&'_ mut self) -> Result<String, Error>
[src]
Gets the version of the server.
If the version is retrieved successfully, String
is returned containing the version
component e.g. 1.6.7
, otherwise Error
is returned.
For some setups, such as those using Twemproxy, this will return an error as those intermediate proxies do not support the version command.
pub async fn dump_keys<'_, '_>(&'_ mut self) -> Result<MetadumpIter<'_>, Error>
[src]
Dumps all keys from the server.
This operation scans all slab classes from tail to head, in a non-blocking fashion. Thus, not all items will be found as new items could be inserted or deleted while the crawler is still running.
MetadumpIter
must be iterated over to discover whether or not the crawler successfully
started, as this call will only return Error
if the command failed to be written to the
server at all.
Available as of memcached 1.4.31.
pub async fn stats<'_>(&'_ mut self) -> Result<HashMap<String, String>, Error>
[src]
Collects statistics from the server.
The statistics that may be returned are detailed in the protocol specification for memcached, but all values returned by this method are returned as strings and are not further interpreted or validated for conformity.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,