Trait AsciiProtocol

Source
pub trait AsciiProtocol {
Show 14 methods // Required methods fn get<K: AsRef<[u8]>>( &mut self, key: K, ) -> impl Future<Output = Result<Option<Value>, Error>>; fn get_multi<I, K>( &mut self, keys: I, ) -> impl Future<Output = Result<Vec<Value>, Error>> where I: IntoIterator<Item = K>, K: AsRef<[u8]>; fn get_many<I, K>( &mut self, keys: I, ) -> impl Future<Output = Result<Vec<Value>, Error>> where I: IntoIterator<Item = K>, K: AsRef<[u8]>; fn set<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>, V: AsMemcachedValue; fn set_multi<'a, K, V>( &mut self, kv: &'a [(K, V)], ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<FxHashMap<&'a K, Result<(), Error>>, Error>> where K: AsRef<[u8]> + Eq + Hash + Debug, V: AsMemcachedValue; fn add<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>, V: AsMemcachedValue; fn add_multi<'a, K, V>( &mut self, kv: &'a [(K, V)], ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<FxHashMap<&'a K, Result<(), Error>>, Error>> where K: AsRef<[u8]> + Eq + Hash + Debug, V: AsMemcachedValue; fn delete_multi_no_reply<K>( &mut self, keys: &[K], ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>; fn delete_no_reply<K>( &mut self, key: K, ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>; fn delete<K>(&mut self, key: K) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>; fn increment<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>> where K: AsRef<[u8]>; fn increment_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>; fn decrement<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>> where K: AsRef<[u8]>; fn decrement_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>> where K: AsRef<[u8]>;
}
Expand description

Trait defining ASCII protocol-specific methods for the Client.

Required Methods§

Source

fn get<K: AsRef<[u8]>>( &mut self, key: K, ) -> impl Future<Output = 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.

Source

fn get_multi<I, K>( &mut self, keys: I, ) -> impl Future<Output = Result<Vec<Value>, Error>>
where I: IntoIterator<Item = K>, K: AsRef<[u8]>,

Gets multiple keys.

If any of the keys are found, a vector of Value will be returned.

Otherwise, Error is returned.

Source

fn get_many<I, K>( &mut self, keys: I, ) -> impl Future<Output = Result<Vec<Value>, Error>>
where I: IntoIterator<Item = K>, K: AsRef<[u8]>,

👎Deprecated since 0.4.0: This is now an alias for get_multi, and will be removed in the future.

Gets the given keys.

Deprecated: This is now an alias for get_multi, and will be removed in the future.

Source

fn set<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>, V: AsMemcachedValue,

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.

Source

fn set_multi<'a, K, V>( &mut self, kv: &'a [(K, V)], ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<FxHashMap<&'a K, Result<(), Error>>, Error>>
where K: AsRef<[u8]> + Eq + Hash + Debug, V: AsMemcachedValue,

Sets multiple keys and values through pipelined commands.

If ttl or flags are not specified, they will default to 0. The same values for ttl and flags will be applied to each key. Returns a result with a HashMap of keys mapped to the result of the set operation, or an error.

Source

fn add<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>, V: AsMemcachedValue,

Add a key. If the value exists, Err(Protocol(NotStored)) is returned.

Source

fn add_multi<'a, K, V>( &mut self, kv: &'a [(K, V)], ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<FxHashMap<&'a K, Result<(), Error>>, Error>>
where K: AsRef<[u8]> + Eq + Hash + Debug, V: AsMemcachedValue,

Attempts to add multiple keys and values through pipelined commands.

If ttl or flags are not specified, they will default to 0. The same values for ttl and flags will be applied to each key. Returns a result with a HashMap of keys mapped to the result of the add operation, or an error.

Source

fn delete_multi_no_reply<K>( &mut self, keys: &[K], ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>,

Delete multiple keys

Source

fn delete_no_reply<K>( &mut self, key: K, ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>,

Delete a key but don’t wait for a reply.

Source

fn delete<K>(&mut self, key: K) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>,

Delete a key and wait for a reply.

Source

fn increment<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>>
where K: AsRef<[u8]>,

Increments the given key by the specified amount. Can overflow from the max value of u64 (18446744073709551615) -> 0. If the key does not exist, the server will return a KeyNotFound error. If the key exists but the value is non-numeric, the server will return a ClientError.

Source

fn increment_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>,

Increments the given key by the specified amount with no reply from the server. Can overflow from the max value of u64 (18446744073709551615) -> 0. Always returns () for a complete request, will not return any indication of success or failure.

Source

fn decrement<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>>
where K: AsRef<[u8]>,

Decrements the given key by the specified amount. Will not decrement the counter below 0. If the key does not exist, the server will return a KeyNotFound error. If the key exists but the value is non-numeric, the server will return a ClientError.

Source

fn decrement_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>>
where K: AsRef<[u8]>,

Decrements the given key by the specified amount with no reply from the server. Will not decrement the counter below 0. Always returns () for a complete request, will not return any indication of success or failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§