Struct rsmc_core::client::Client [−][src]
A client manages connections to every node in a memcached cluster using consistent hashing to decide which connection to use based on the key.
Implementations
impl<C: Connection, P: Compressor> Client<C, P>
[src]
pub async fn new(config: ClientConfig<P>) -> Result<Self, Error>
[src]
Create a new client using the client config provided.
pub async fn get<K: AsRef<[u8]>, V: DeserializeOwned>(
&mut self,
key: K
) -> Result<Option<V>, Error>
[src]
&mut self,
key: K
) -> Result<Option<V>, Error>
Get a single value from memcached. Returns None when the key is not found (i.e., a miss).
pub async fn get_multi<'a, K: AsRef<[u8]>, V: DeserializeOwned>(
&mut self,
keys: &[K]
) -> BulkGetResponse<V>
[src]
&mut self,
keys: &[K]
) -> BulkGetResponse<V>
Get multiple values from memcached at once. On success, it returns a tuple of (ok, err) responses. The error responses can be treated as misses, but should be logged for visibility. Lots of errors could be indicative of a serious problem.
pub async fn set<K: AsRef<[u8]>, V: Serialize + ?Sized>(
&mut self,
key: K,
data: &V,
expire: u32
) -> Result<(), Error>
[src]
&mut self,
key: K,
data: &V,
expire: u32
) -> Result<(), Error>
Set a single key/value pair in memcached to expire at the desired
time. A value of 0 means “never expire”, but the value could still be
evicted by the LRU cache. Important: if expire
is set to more than 30
days in the future, then memcached will treat it as a unix timestamp
instead of a duration.
pub async fn set_multi<'a, V: Serialize, K: AsRef<[u8]> + Eq + Hash>(
&mut self,
data: HashMap<K, V>,
expire: u32
) -> BulkUpdateResponse
[src]
&mut self,
data: HashMap<K, V>,
expire: u32
) -> BulkUpdateResponse
Set multiple key/value pairs in memcached to expire at the desired
time. A value of 0 means “never expire”, but the value could still be
evicted by the LRU cache. Important: if expire
is set to more than 30
days in the future, then memcached will treat it as a unix timestamp
instead of a duration.
pub async fn delete<K: AsRef<[u8]>>(&mut self, key: K) -> Result<(), Error>
[src]
Delete a key from memcached. Does nothing if the key is not set.
pub async fn delete_multi<K: AsRef<[u8]>>(
&mut self,
keys: &[K]
) -> BulkUpdateResponse
[src]
&mut self,
keys: &[K]
) -> BulkUpdateResponse
Delete multiple keys from memcached. Does nothing when a key is unset.
Trait Implementations
impl<C: Clone + Connection, P: Clone + Compressor> Clone for Client<C, P>
[src]
impl<C: Debug + Connection, P: Debug + Compressor> Debug for Client<C, P>
[src]
impl<C, P> Manager<Client<C, P>, Error> for ClientConfig<P> where
C: Connection,
P: Compressor,
[src]
C: Connection,
P: Compressor,
fn create<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Client<C, P>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Client<C, P>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn recycle<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 mut Client<C, P>
) -> Pin<Box<dyn Future<Output = RecycleResult<Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
client: &'life1 mut Client<C, P>
) -> Pin<Box<dyn Future<Output = RecycleResult<Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl<C, P> RefUnwindSafe for Client<C, P> where
C: RefUnwindSafe,
P: RefUnwindSafe,
C: RefUnwindSafe,
P: RefUnwindSafe,
impl<C, P> Send for Client<C, P>
impl<C, P> Sync for Client<C, P>
impl<C, P> Unpin for Client<C, P> where
C: Unpin,
P: Unpin,
C: Unpin,
P: Unpin,
impl<C, P> UnwindSafe for Client<C, P> where
C: UnwindSafe,
P: UnwindSafe,
C: UnwindSafe,
P: UnwindSafe,
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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>,