pub trait RedisConnection:
Send
+ Sync
+ 'static {
// Required methods
fn run(&self, cmd: Cmd) -> BoxFuture<'_, RedisResult<Value>>;
fn run_on_primary(
&self,
key: &str,
cmd: Cmd,
) -> BoxFuture<'_, RedisResult<Value>>;
}Expand description
A cloneable, task-shareable handle that runs one Redis command.
Implemented for [ConnectionManager], [MultiplexedConnection] and
[ClusterConnection]. Test doubles implement it to observe dispatched
arguments without a server. Every method borrows &self; implementations
clone the underlying handle per command, which the redis crate’s handles
make cheap.
Required Methods§
Sourcefn run(&self, cmd: Cmd) -> BoxFuture<'_, RedisResult<Value>>
fn run(&self, cmd: Cmd) -> BoxFuture<'_, RedisResult<Value>>
Run one command with the handle’s default routing.
Sourcefn run_on_primary(
&self,
key: &str,
cmd: Cmd,
) -> BoxFuture<'_, RedisResult<Value>>
fn run_on_primary( &self, key: &str, cmd: Cmd, ) -> BoxFuture<'_, RedisResult<Value>>
Run one command that reads key, on the node that owns the key’s
slot as a primary. Non-cluster handles have exactly one node and use
their default routing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".