Struct vmemcached::Client
source · [−]pub struct Client(_);Expand description
Client wrapping r2d2 memcached connection pool
Implementations
sourceimpl Client
impl Client
sourcepub async fn get_connection(
&self
) -> Result<PooledConnection<'_, ConnectionManager>, MemcacheError>
pub async fn get_connection(
&self
) -> Result<PooledConnection<'_, ConnectionManager>, MemcacheError>
Get pool connection
sourcepub async fn version(&self) -> Result<String, MemcacheError>
pub async fn version(&self) -> Result<String, MemcacheError>
Get the server version
sourcepub async fn get<K: AsRef<[u8]>, V: DeserializeOwned>(
&self,
key: K
) -> Result<Option<V>, MemcacheError>
pub async fn get<K: AsRef<[u8]>, V: DeserializeOwned>(
&self,
key: K
) -> Result<Option<V>, MemcacheError>
Get a key from memcached server.
sourcepub async fn gets<K: AsRef<[u8]>, V: DeserializeOwned>(
&self,
keys: &[K]
) -> Result<Option<HashMap<String, V>>, MemcacheError>
pub async fn gets<K: AsRef<[u8]>, V: DeserializeOwned>(
&self,
keys: &[K]
) -> Result<Option<HashMap<String, V>>, MemcacheError>
Get keys from memcached server.
sourcepub async fn set<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
pub async fn set<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
Set a key with associate value into memcached server with expiration seconds.
sourcepub async fn add<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
pub async fn add<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
Add means “store this data, but only if the server doesn’t already hold data for this key”.
sourcepub async fn replace<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
pub async fn replace<K: AsRef<[u8]>, T: Serialize, E>(
&self,
key: K,
value: T,
expiration: E
) -> Result<Status, MemcacheError> where
E: Into<Option<Duration>>,
“replace” means “store this data, but only if the server does already hold data for this key”.
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more