Trait fred::interfaces::KeysInterface
source · pub trait KeysInterface: ClientLike + Sized {
Show 35 methods
// Provided methods
fn watch<K>(&self, keys: K) -> impl Future<Output = RedisResult<()>>
where K: Into<MultipleKeys> { ... }
fn unwatch(&self) -> impl Future<Output = RedisResult<()>> { ... }
fn randomkey<R>(&self) -> impl Future<Output = RedisResult<R>>
where R: FromRedis { ... }
fn copy<R, S, D>(
&self,
source: S,
destination: D,
db: Option<u8>,
replace: bool,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
S: Into<RedisKey>,
D: Into<RedisKey> { ... }
fn dump<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn restore<R, K>(
&self,
key: K,
ttl: i64,
serialized: RedisValue,
replace: bool,
absttl: bool,
idletime: Option<i64>,
frequency: Option<i64>,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn set<R, K, V>(
&self,
key: K,
value: V,
expire: Option<Expiration>,
options: Option<SetOptions>,
get: bool,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey>,
V: TryInto<RedisValue>,
V::Error: Into<RedisError> { ... }
fn get<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn getrange<R, K>(
&self,
key: K,
start: usize,
end: usize,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn setrange<R, K, V>(
&self,
key: K,
offset: u32,
value: V,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey>,
V: TryInto<RedisValue>,
V::Error: Into<RedisError> { ... }
fn getset<R, K, V>(
&self,
key: K,
value: V,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey>,
V: TryInto<RedisValue>,
V::Error: Into<RedisError> { ... }
fn getdel<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn strlen<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn del<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<MultipleKeys> { ... }
fn unlink<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<MultipleKeys> { ... }
fn rename<R, S, D>(
&self,
source: S,
destination: D,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
S: Into<RedisKey>,
D: Into<RedisKey> { ... }
fn renamenx<R, S, D>(
&self,
source: S,
destination: D,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
S: Into<RedisKey>,
D: Into<RedisKey> { ... }
fn append<R, K, V>(
&self,
key: K,
value: V,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey>,
V: TryInto<RedisValue>,
V::Error: Into<RedisError> { ... }
fn mget<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<MultipleKeys> { ... }
fn mset<V>(&self, values: V) -> impl Future<Output = RedisResult<()>>
where V: TryInto<RedisMap>,
V::Error: Into<RedisError> { ... }
fn msetnx<R, V>(&self, values: V) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
V: TryInto<RedisMap>,
V::Error: Into<RedisError> { ... }
fn incr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn incr_by<R, K>(
&self,
key: K,
val: i64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn incr_by_float<R, K>(
&self,
key: K,
val: f64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn decr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn decr_by<R, K>(
&self,
key: K,
val: i64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn ttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn pttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn persist<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn expire<R, K>(
&self,
key: K,
seconds: i64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn expire_at<R, K>(
&self,
key: K,
timestamp: i64,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn pexpire<R, K>(
&self,
key: K,
milliseconds: i64,
options: Option<ExpireOptions>,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn pexpire_at<R, K>(
&self,
key: K,
timestamp: i64,
options: Option<ExpireOptions>,
) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<RedisKey> { ... }
fn exists<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
where R: FromRedis,
K: Into<MultipleKeys> { ... }
fn lcs<R, K1, K2>(
&self,
key1: K1,
key2: K2,
len: bool,
idx: bool,
minmatchlen: Option<i64>,
withmatchlen: bool,
) -> impl Future<Output = Result<R, RedisError>>
where R: FromRedis,
K1: Into<RedisKey>,
K2: Into<RedisKey> { ... }
}i-keys only.Expand description
Functions that implement the generic keys interface.
Provided Methods§
sourcefn watch<K>(&self, keys: K) -> impl Future<Output = RedisResult<()>>where
K: Into<MultipleKeys>,
fn watch<K>(&self, keys: K) -> impl Future<Output = RedisResult<()>>where
K: Into<MultipleKeys>,
Marks the given keys to be watched for conditional execution of a transaction.
sourcefn unwatch(&self) -> impl Future<Output = RedisResult<()>>
fn unwatch(&self) -> impl Future<Output = RedisResult<()>>
Flushes all the previously watched keys for a transaction.
sourcefn randomkey<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
fn randomkey<R>(&self) -> impl Future<Output = RedisResult<R>>where
R: FromRedis,
Return a random key from the currently selected database.
sourcefn copy<R, S, D>(
&self,
source: S,
destination: D,
db: Option<u8>,
replace: bool,
) -> impl Future<Output = RedisResult<R>>
fn copy<R, S, D>( &self, source: S, destination: D, db: Option<u8>, replace: bool, ) -> impl Future<Output = RedisResult<R>>
This command copies the value stored at the source key to the destination key.
sourcefn dump<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn dump<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Serialize the value stored at key in a Redis-specific format and return it as bulk string.
sourcefn restore<R, K>(
&self,
key: K,
ttl: i64,
serialized: RedisValue,
replace: bool,
absttl: bool,
idletime: Option<i64>,
frequency: Option<i64>,
) -> impl Future<Output = RedisResult<R>>
fn restore<R, K>( &self, key: K, ttl: i64, serialized: RedisValue, replace: bool, absttl: bool, idletime: Option<i64>, frequency: Option<i64>, ) -> impl Future<Output = RedisResult<R>>
Create a key associated with a value that is obtained by deserializing the provided serialized value
sourcefn set<R, K, V>(
&self,
key: K,
value: V,
expire: Option<Expiration>,
options: Option<SetOptions>,
get: bool,
) -> impl Future<Output = RedisResult<R>>
fn set<R, K, V>( &self, key: K, value: V, expire: Option<Expiration>, options: Option<SetOptions>, get: bool, ) -> impl Future<Output = RedisResult<R>>
Set a value with optional NX|XX, EX|PX|EXAT|PXAT|KEEPTTL, and GET arguments.
Note: the get flag was added in 6.2.0. Setting it as false works with Redis versions <=6.2.0.
sourcefn get<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn get<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Read a value from the server.
sourcefn getrange<R, K>(
&self,
key: K,
start: usize,
end: usize,
) -> impl Future<Output = RedisResult<R>>
fn getrange<R, K>( &self, key: K, start: usize, end: usize, ) -> impl Future<Output = RedisResult<R>>
Returns the substring of the string value stored at key with offsets start and end (both inclusive).
Note: Command formerly called SUBSTR in Redis verison <=2.0.
sourcefn setrange<R, K, V>(
&self,
key: K,
offset: u32,
value: V,
) -> impl Future<Output = RedisResult<R>>
fn setrange<R, K, V>( &self, key: K, offset: u32, value: V, ) -> impl Future<Output = RedisResult<R>>
Overwrites part of the string stored at key, starting at the specified offset, for the entire length of
value.
sourcefn getset<R, K, V>(
&self,
key: K,
value: V,
) -> impl Future<Output = RedisResult<R>>
fn getset<R, K, V>( &self, key: K, value: V, ) -> impl Future<Output = RedisResult<R>>
Atomically sets key to value and returns the old value stored at key.
Returns an error if key does not hold string value. Returns nil if key does not exist.
sourcefn getdel<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn getdel<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Get the value of key and delete the key. This command is similar to GET, except for the fact that it also deletes the key on success (if and only if the key’s value type is a string).
sourcefn strlen<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn strlen<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Returns the length of the string value stored at key. An error is returned when key holds a non-string value.
sourcefn del<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
fn del<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
Removes the specified keys. A key is ignored if it does not exist.
Returns the number of keys removed.
sourcefn unlink<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
fn unlink<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
Unlinks the specified keys. A key is ignored if it does not exist
Returns the number of keys removed.
sourcefn rename<R, S, D>(
&self,
source: S,
destination: D,
) -> impl Future<Output = RedisResult<R>>
fn rename<R, S, D>( &self, source: S, destination: D, ) -> impl Future<Output = RedisResult<R>>
Renames source key to destination.
Returns an error when source does not exist. If destination exists, it gets overwritten.
sourcefn renamenx<R, S, D>(
&self,
source: S,
destination: D,
) -> impl Future<Output = RedisResult<R>>
fn renamenx<R, S, D>( &self, source: S, destination: D, ) -> impl Future<Output = RedisResult<R>>
Renames source key to destination if destination does not yet exist.
Returns an error when source does not exist.
sourcefn append<R, K, V>(
&self,
key: K,
value: V,
) -> impl Future<Output = RedisResult<R>>
fn append<R, K, V>( &self, key: K, value: V, ) -> impl Future<Output = RedisResult<R>>
Append value to key if it’s a string.
sourcefn mget<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
fn mget<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
Returns the values of all specified keys. For every key that does not hold a string value or does not exist, the special value nil is returned.
sourcefn mset<V>(&self, values: V) -> impl Future<Output = RedisResult<()>>
fn mset<V>(&self, values: V) -> impl Future<Output = RedisResult<()>>
Sets the given keys to their respective values.
sourcefn msetnx<R, V>(&self, values: V) -> impl Future<Output = RedisResult<R>>
fn msetnx<R, V>(&self, values: V) -> impl Future<Output = RedisResult<R>>
Sets the given keys to their respective values. MSETNX will not perform any operation at all even if just a single key already exists.
sourcefn incr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn incr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the
operation.
Returns an error if the value at key is of the wrong type.
sourcefn incr_by<R, K>(
&self,
key: K,
val: i64,
) -> impl Future<Output = RedisResult<R>>
fn incr_by<R, K>( &self, key: K, val: i64, ) -> impl Future<Output = RedisResult<R>>
Increments the number stored at key by val. If the key does not exist, it is set to 0 before performing the
operation.
Returns an error if the value at key is of the wrong type.
sourcefn incr_by_float<R, K>(
&self,
key: K,
val: f64,
) -> impl Future<Output = RedisResult<R>>
fn incr_by_float<R, K>( &self, key: K, val: f64, ) -> impl Future<Output = RedisResult<R>>
Increment the string representing a floating point number stored at key by val. If the key does not exist, it
is set to 0 before performing the operation.
Returns an error if key value is the wrong type or if the current value cannot be parsed as a floating point value.
sourcefn decr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn decr<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Decrements the number stored at key by one. If the key does not exist, it is set to 0 before performing the
operation.
Returns an error if the key contains a value of the wrong type.
sourcefn decr_by<R, K>(
&self,
key: K,
val: i64,
) -> impl Future<Output = RedisResult<R>>
fn decr_by<R, K>( &self, key: K, val: i64, ) -> impl Future<Output = RedisResult<R>>
Decrements the number stored at key by val. If the key does not exist, it is set to 0 before performing the
operation.
Returns an error if the key contains a value of the wrong type.
sourcefn ttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn ttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Returns the remaining time to live of a key that has a timeout, in seconds.
sourcefn pttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn pttl<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Returns the remaining time to live of a key that has a timeout, in milliseconds.
sourcefn persist<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
fn persist<R, K>(&self, key: K) -> impl Future<Output = RedisResult<R>>
Remove the existing timeout on a key, turning the key from volatile (a key with an expiration) to persistent (a key that will never expire as no timeout is associated).
Returns a boolean value describing whether the timeout was removed.
sourcefn expire<R, K>(
&self,
key: K,
seconds: i64,
) -> impl Future<Output = RedisResult<R>>
fn expire<R, K>( &self, key: K, seconds: i64, ) -> impl Future<Output = RedisResult<R>>
Set a timeout on key. After the timeout has expired, the key will be automatically deleted.
sourcefn expire_at<R, K>(
&self,
key: K,
timestamp: i64,
) -> impl Future<Output = RedisResult<R>>
fn expire_at<R, K>( &self, key: K, timestamp: i64, ) -> impl Future<Output = RedisResult<R>>
Set a timeout on a key based on a UNIX timestamp.
sourcefn pexpire<R, K>(
&self,
key: K,
milliseconds: i64,
options: Option<ExpireOptions>,
) -> impl Future<Output = RedisResult<R>>
fn pexpire<R, K>( &self, key: K, milliseconds: i64, options: Option<ExpireOptions>, ) -> impl Future<Output = RedisResult<R>>
This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.
sourcefn pexpire_at<R, K>(
&self,
key: K,
timestamp: i64,
options: Option<ExpireOptions>,
) -> impl Future<Output = RedisResult<R>>
fn pexpire_at<R, K>( &self, key: K, timestamp: i64, options: Option<ExpireOptions>, ) -> impl Future<Output = RedisResult<R>>
PEXPIREAT has the same effect and semantic as EXPIREAT, but the Unix time at which the key will expire is specified in milliseconds instead of seconds.
sourcefn exists<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
fn exists<R, K>(&self, keys: K) -> impl Future<Output = RedisResult<R>>
Returns number of keys that exist from the keys arguments.