Trait RedisOps

Source
pub trait RedisOps:
    Sized
    + ConnectionLike
    + Send
    + 'static {
    // Provided methods
    fn query<'a, T>(&'a mut self, cmd: &'a Cmd) -> RedisFuture<'a, T>
       where T: FromRedisValue + Send + 'static { ... }
    fn execute<'a, T>(&'a mut self, cmd: &'a Cmd) -> RedisFuture<'a, ()>
       where T: FromRedisValue + Send + 'static { ... }
    fn ping<'a>(&'a mut self) -> RedisFuture<'a, Duration> { ... }
    fn flushall<'a>(&'a mut self) -> RedisFuture<'a, ()> { ... }
    fn flushall_async<'a>(&'a mut self) -> RedisFuture<'a, ()> { ... }
    fn quit<'a>(&'a mut self) -> RedisFuture<'a, ()> { ... }
    fn client_id<'a>(&'a mut self) -> RedisFuture<'_, i64> { ... }
    fn client_kill_id<'a>(&'a mut self, id: i64) -> RedisFuture<'_, ()> { ... }
    fn db_size<'a>(&'a mut self) -> RedisFuture<'_, i64> { ... }
}
Expand description

A helper trait to easily execute common asynchronous Redis operations on a redis::aio::ConnectionLike

Provided Methods§

Source

fn query<'a, T>(&'a mut self, cmd: &'a Cmd) -> RedisFuture<'a, T>
where T: FromRedisValue + Send + 'static,

Execute a command and expect a result

Source

fn execute<'a, T>(&'a mut self, cmd: &'a Cmd) -> RedisFuture<'a, ()>
where T: FromRedisValue + Send + 'static,

Execute a command and do not expect a result and instead just check whether the command did not fail

Source

fn ping<'a>(&'a mut self) -> RedisFuture<'a, Duration>

Send a ping command and return the roundrip time if successful

Source

fn flushall<'a>(&'a mut self) -> RedisFuture<'a, ()>

Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.

The time-complexity for this operation is O(N), N being the number of keys in all existing databases.

Source

fn flushall_async<'a>(&'a mut self) -> RedisFuture<'a, ()>

Delete all the keys of all the existing databases

Redis (since 4.0,0) is now able to delete keys in the background in a different thread without blocking the server. An ASYNC option was added to FLUSHALL and FLUSHDB in order to let the entire dataset or a single database to be freed asynchronously.

Asynchronous FLUSHALL and FLUSHDB commands only delete keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected.

Source

fn quit<'a>(&'a mut self) -> RedisFuture<'a, ()>

Ask the server to close the connection.

The connection is closed as soon as all pending replies have been written to the client.

Source

fn client_id<'a>(&'a mut self) -> RedisFuture<'_, i64>

Source

fn client_kill_id<'a>(&'a mut self, id: i64) -> RedisFuture<'_, ()>

Source

fn db_size<'a>(&'a mut self) -> RedisFuture<'_, i64>

Determine the number of keys.

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§

Source§

impl<T> RedisOps for T
where T: ConnectionLike + Sized + Send + 'static,