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

A group of generic Redis commands

See Also

Redis Generic Commands

Provided Methods

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/

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/

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/

Returns if keys exist.

Return

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

See Also

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

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/

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/

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/

Returns all keys matching pattern.

Return

list of keys matching pattern.

See Also

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

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/

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/

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/

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/

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/

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

Return

The number of references.

See Also

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

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/

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/

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/

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/

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/

Return a random key from the currently selected database.

Return

The number of references.

See Also

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

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/

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/

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

Return

A list of keys

See Also

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

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/

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/

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/

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/

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/

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/

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