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§
Sourcefn get<K: AsRef<[u8]>>(
&mut self,
key: K,
) -> impl Future<Output = Result<Option<Value>, Error>>
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.
Sourcefn get_many<I, K>(
&mut self,
keys: I,
) -> impl Future<Output = Result<Vec<Value>, Error>>
👎Deprecated since 0.4.0: This is now an alias for get_multi
, and will be removed in the future.
fn get_many<I, K>( &mut self, keys: I, ) -> impl Future<Output = Result<Vec<Value>, Error>>
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.
Sourcefn set<K, V>(
&mut self,
key: K,
value: V,
ttl: Option<i64>,
flags: Option<u32>,
) -> impl Future<Output = Result<(), Error>>
fn set<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>>
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.
Sourcefn 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>>
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>>
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.
Sourcefn add<K, V>(
&mut self,
key: K,
value: V,
ttl: Option<i64>,
flags: Option<u32>,
) -> impl Future<Output = Result<(), Error>>
fn add<K, V>( &mut self, key: K, value: V, ttl: Option<i64>, flags: Option<u32>, ) -> impl Future<Output = Result<(), Error>>
Add a key. If the value exists, Err(Protocol(NotStored)) is returned.
Sourcefn 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>>
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>>
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.
Sourcefn delete_multi_no_reply<K>(
&mut self,
keys: &[K],
) -> impl Future<Output = Result<(), Error>>
fn delete_multi_no_reply<K>( &mut self, keys: &[K], ) -> impl Future<Output = Result<(), Error>>
Delete multiple keys
Sourcefn delete_no_reply<K>(
&mut self,
key: K,
) -> impl Future<Output = Result<(), Error>>
fn delete_no_reply<K>( &mut self, key: K, ) -> impl Future<Output = Result<(), Error>>
Delete a key but don’t wait for a reply.
Sourcefn delete<K>(&mut self, key: K) -> impl Future<Output = Result<(), Error>>
fn delete<K>(&mut self, key: K) -> impl Future<Output = Result<(), Error>>
Delete a key and wait for a reply.
Sourcefn increment<K>(
&mut self,
key: K,
amount: u64,
) -> impl Future<Output = Result<u64, Error>>
fn increment<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>>
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.
Sourcefn increment_no_reply<K>(
&mut self,
key: K,
amount: u64,
) -> impl Future<Output = Result<(), Error>>
fn increment_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>>
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.
Sourcefn decrement<K>(
&mut self,
key: K,
amount: u64,
) -> impl Future<Output = Result<u64, Error>>
fn decrement<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<u64, Error>>
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.
Sourcefn decrement_no_reply<K>(
&mut self,
key: K,
amount: u64,
) -> impl Future<Output = Result<(), Error>>
fn decrement_no_reply<K>( &mut self, key: K, amount: u64, ) -> impl Future<Output = Result<(), Error>>
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.