Trait GenericCommands

Source
pub trait GenericCommands<'a> {
Show 32 methods // Provided methods fn copy<S, D>( self, source: S, destination: D, destination_db: Option<usize>, replace: bool, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, S: SingleArg, D: SingleArg { ... } fn del<K, C>(self, keys: C) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, C: SingleArgCollection<K> { ... } fn dump<K>(self, key: K) -> PreparedCommand<'a, Self, DumpResult> where Self: Sized, K: SingleArg { ... } fn exists<K, C>(self, keys: C) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, C: SingleArgCollection<K> { ... } fn expire<K>( self, key: K, seconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg { ... } fn expireat<K>( self, key: K, unix_time_seconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg { ... } fn expiretime<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn keys<P, K, A>(self, pattern: P) -> PreparedCommand<'a, Self, A> where Self: Sized, P: SingleArg, K: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<K> + DeserializeOwned { ... } fn migrate<H, K>( self, host: H, port: u16, key: K, destination_db: usize, timeout: u64, options: MigrateOptions, ) -> PreparedCommand<'a, Self, MigrateResult> where Self: Sized, H: SingleArg, K: SingleArg { ... } fn move_<K>(self, key: K, db: usize) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn object_encoding<K, E>(self, key: K) -> PreparedCommand<'a, Self, E> where Self: Sized, K: SingleArg, E: PrimitiveResponse { ... } fn object_freq<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn object_idle_time<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn object_refcount<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn persist<K>(self, key: K) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg { ... } fn pexpire<K>( self, key: K, milliseconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg { ... } fn pexpireat<K>( self, key: K, unix_time_milliseconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg { ... } fn pexpiretime<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn pttl<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn randomkey<R>(self) -> PreparedCommand<'a, Self, R> where Self: Sized, R: PrimitiveResponse { ... } fn rename<K1, K2>( self, key: K1, new_key: K2, ) -> PreparedCommand<'a, Self, ()> where Self: Sized, K1: SingleArg, K2: SingleArg { ... } fn renamenx<K1, K2>( self, key: K1, new_key: K2, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K1: SingleArg, K2: SingleArg { ... } fn restore<K>( self, key: K, ttl: u64, serialized_value: Vec<u8>, options: RestoreOptions, ) -> PreparedCommand<'a, Self, ()> where Self: Sized, K: SingleArg { ... } fn scan<K, A>( self, cursor: u64, options: ScanOptions, ) -> PreparedCommand<'a, Self, (u64, A)> where Self: Sized, K: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<K> + DeserializeOwned { ... } fn sort<K, M, A>( self, key: K, options: SortOptions, ) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, M: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<M> + DeserializeOwned { ... } fn sort_and_store<K, D>( self, key: K, destination: D, options: SortOptions, ) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, D: SingleArg { ... } fn sort_readonly<K, M, A>( self, key: K, options: SortOptions, ) -> PreparedCommand<'a, Self, A> where Self: Sized, K: SingleArg, M: PrimitiveResponse + DeserializeOwned, A: CollectionResponse<M> + DeserializeOwned { ... } fn touch<K, KK>(self, keys: KK) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, KK: SingleArgCollection<K> { ... } fn ttl<K>(self, key: K) -> PreparedCommand<'a, Self, i64> where Self: Sized, K: SingleArg { ... } fn type_<K>(self, key: K) -> PreparedCommand<'a, Self, String> where Self: Sized, K: SingleArg { ... } fn unlink<K, C>(self, keys: C) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg, C: SingleArgCollection<K> { ... } fn wait( self, num_replicas: usize, timeout: u64, ) -> PreparedCommand<'a, Self, usize> where Self: Sized { ... }
}
Expand description

A group of generic Redis commands

§See Also

Redis Generic Commands

Provided Methods§

Source

fn copy<S, D>( self, source: S, destination: D, destination_db: Option<usize>, replace: bool, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, S: SingleArg, D: SingleArg,

This command copies the value stored at the source key to the destination key.

§Return

Success of the operation

§See Also

https://redis.io/commands/copy/

Source

fn del<K, C>(self, keys: C) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, C: SingleArgCollection<K>,

Removes the specified keys. A key is ignored if it does not exist.

§Return

The number of keys that were removed.

§See Also

https://redis.io/commands/del/

Source

fn dump<K>(self, key: K) -> PreparedCommand<'a, Self, DumpResult>
where Self: Sized, K: SingleArg,

Serialize the value stored at key in a Redis-specific format and return it to the user.

§Return

The serialized value.

§See Also

https://redis.io/commands/dump/

Source

fn exists<K, C>(self, keys: C) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, C: SingleArgCollection<K>,

Returns if keys exist.

§Return

The number of keys that exist from those specified as arguments.

§See Also

https://redis.io/commands/exists/

Source

fn expire<K>( self, key: K, seconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg,

Set a timeout on key in seconds

§Return
  • true - if the timeout was set.
  • false - if the timeout was not set. e.g. key doesn’t exist, or operation skipped due to the provided arguments.
§See Also

https://redis.io/commands/expire/

Source

fn expireat<K>( self, key: K, unix_time_seconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg,

EXPIREAT has the same effect and semantic as EXPIRE, but instead of specifying the number of seconds representing the TTL (time to live), it takes an absolute Unix timestamp (seconds since January 1, 1970)

A timestamp in the past will delete the key

§Return
  • true - if the timeout was set.
  • false - if the timeout was not set. e.g. key doesn’t exist, or operation skipped due to the provided arguments.
§See Also

https://redis.io/commands/expireat/

Source

fn expiretime<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.

§Return

Expiration Unix timestamp in seconds, or a negative value in order to signal an error (see the description below).

  • The command returns -1 if the key exists but has no associated expiration time.
  • The command returns -2 if the key does not exist.
§See Also

https://redis.io/commands/expiretime/

Source

fn keys<P, K, A>(self, pattern: P) -> PreparedCommand<'a, Self, A>

Returns all keys matching pattern.

§Return

list of keys matching pattern.

§See Also

https://redis.io/commands/keys/

Source

fn migrate<H, K>( self, host: H, port: u16, key: K, destination_db: usize, timeout: u64, options: MigrateOptions, ) -> PreparedCommand<'a, Self, MigrateResult>
where Self: Sized, H: SingleArg, K: SingleArg,

Atomically transfer a key or a collection of keys from a source Redis instance to a destination Redis instance.

§Return
  • true - on success
  • false - if no keys were found in the source instance.
§See Also

https://redis.io/commands/migrate/

Source

fn move_<K>(self, key: K, db: usize) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

Move key from the currently selected database to the specified destination database.

§Return
  • true - if key was moved.
  • false - f key was not moved.
§See Also

https://redis.io/commands/move/

Source

fn object_encoding<K, E>(self, key: K) -> PreparedCommand<'a, Self, E>
where Self: Sized, K: SingleArg, E: PrimitiveResponse,

Returns the internal encoding for the Redis object stored at key

§Return

The encoding of the object, or nil if the key doesn’t exist

§See Also

https://redis.io/commands/object-encoding/

Source

fn object_freq<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

This command returns the logarithmic access frequency counter of a Redis object stored at key.

§Return

The counter’s value.

§See Also

https://redis.io/commands/object-freq/

Source

fn object_idle_time<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

This command returns the time in seconds since the last access to the value stored at key.

§Return

The idle time in seconds.

§See Also

https://redis.io/commands/object-idletime/

Source

fn object_refcount<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

This command returns the reference count of the stored at key.

§Return

The number of references.

§See Also

https://redis.io/commands/object-refcount/

Source

fn persist<K>(self, key: K) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg,

Remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).

§Return
  • true - if the timeout was removed.
  • false - if key does not exist or does not have an associated timeout.
§See Also

https://redis.io/commands/persist/

Source

fn pexpire<K>( self, key: K, milliseconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg,

This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.

§Return
  • true - if the timeout was set.
  • false - if the timeout was not set. e.g. key doesn’t exist, or operation skipped due to the provided arguments.
§See Also

https://redis.io/commands/pexpire/

Source

fn pexpireat<K>( self, key: K, unix_time_milliseconds: u64, option: ExpireOption, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg,

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.

§Return
  • true - if the timeout was set.
  • false - if the timeout was not set. e.g. key doesn’t exist, or operation skipped due to the provided arguments.
§See Also

https://redis.io/commands/pexpireat/

Source

fn pexpiretime<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

PEXPIRETIME has the same semantic as EXPIRETIME, but returns the absolute Unix expiration timestamp in milliseconds instead of seconds.

§Return

Expiration Unix timestamp in milliseconds, or a negative value in order to signal an error (see the description below).

  • The command returns -1 if the key exists but has no associated expiration time.
  • The command returns -2 if the key does not exist.
§See Also

https://redis.io/commands/pexpiretime/

Source

fn pttl<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

Returns the remaining time to live of a key that has a timeout.

§Return

TTL in milliseconds, or a negative value in order to signal an error: -2 if the key does not exist. -1 if the key exists but has no associated expire.

§See Also

https://redis.io/commands/pttl/

Source

fn randomkey<R>(self) -> PreparedCommand<'a, Self, R>
where Self: Sized, R: PrimitiveResponse,

Return a random key from the currently selected database.

§Return

The number of references.

§See Also

https://redis.io/commands/randomkey/

Source

fn rename<K1, K2>(self, key: K1, new_key: K2) -> PreparedCommand<'a, Self, ()>
where Self: Sized, K1: SingleArg, K2: SingleArg,

Renames key to newkey.

§See Also

https://redis.io/commands/rename/

Source

fn renamenx<K1, K2>( self, key: K1, new_key: K2, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K1: SingleArg, K2: SingleArg,

Renames key to newkey if newkey does not yet exist. It returns an error when key does not exist.

§Return
  • true if key was renamed to newkey.
  • false if newkey already exists.
§See Also

https://redis.io/commands/renamenx/

Source

fn restore<K>( self, key: K, ttl: u64, serialized_value: Vec<u8>, options: RestoreOptions, ) -> PreparedCommand<'a, Self, ()>
where Self: Sized, K: SingleArg,

Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via DUMP).

§Return

Restore command builder

§See Also

https://redis.io/commands/restore/

Source

fn scan<K, A>( self, cursor: u64, options: ScanOptions, ) -> PreparedCommand<'a, Self, (u64, A)>

Iterates the set of keys in the currently selected Redis database.

§Return

A list of keys

§See Also

https://redis.io/commands/scan/

Source

fn sort<K, M, A>( self, key: K, options: SortOptions, ) -> PreparedCommand<'a, Self, A>

Returns the elements contained in the list, set or sorted set at key.

§Return

A collection of sorted elements.

§See Also

https://redis.io/commands/sort/

Source

fn sort_and_store<K, D>( self, key: K, destination: D, options: SortOptions, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, D: SingleArg,

Stores the elements contained in the list, set or sorted set at key.

§Return

The number of sorted elements in the destination list.

§See Also

https://redis.io/commands/sort/

Source

fn sort_readonly<K, M, A>( self, key: K, options: SortOptions, ) -> PreparedCommand<'a, Self, A>

Read-only variant of the SORT command.

It is exactly like the original SORT but refuses the STORE option and can safely be used in read-only replicas.

§Return

A collection of sorted elements.

§See Also

https://redis.io/commands/sort_ro/

Source

fn touch<K, KK>(self, keys: KK) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg, KK: SingleArgCollection<K>,

Alters the last access time of a key(s). A key is ignored if it does not exist.

§Return

The number of keys that were touched.

§See Also

https://redis.io/commands/touch/

Source

fn ttl<K>(self, key: K) -> PreparedCommand<'a, Self, i64>
where Self: Sized, K: SingleArg,

Returns the remaining time to live of a key that has a timeout.

§Return

TTL in seconds, or a negative value in order to signal an error: -2 if the key does not exist. -1 if the key exists but has no associated expire.

§See Also

https://redis.io/commands/ttl/

Source

fn type_<K>(self, key: K) -> PreparedCommand<'a, Self, String>
where Self: Sized, K: SingleArg,

Returns the string representation of the type of the value stored at key.

The different types that can be returned are: string, list, set, zset, hash and stream.

§Return

type of key, or empty string when key does not exist.

§See Also

https://redis.io/commands/type/

This command is very similar to DEL: it removes the specified keys.

§Return

The number of keys that were unlinked.

§See Also

https://redis.io/commands/unlink/

Source

fn wait( self, num_replicas: usize, timeout: u64, ) -> PreparedCommand<'a, Self, usize>
where Self: Sized,

This command blocks the current client until all the previous write commands are successfully transferred and acknowledged by at least the specified number of replicas.

§Return

The number of replicas reached by all the writes performed in the context of the current connection.

§See Also

https://redis.io/commands/wait/

Implementors§

Source§

impl<'a> GenericCommands<'a> for &'a Client

Source§

impl<'a> GenericCommands<'a> for &'a mut Transaction

Source§

impl<'a, 'b> GenericCommands<'a> for &'a mut Pipeline<'b>