Trait redis::ConnectionLike
[−]
[src]
pub trait ConnectionLike { fn req_packed_command(&self, cmd: &[u8]) -> RedisResult<Value>; fn req_packed_commands(&self, cmd: &[u8], offset: usize, count: usize) -> RedisResult<Vec<Value>>; fn get_db(&self) -> i64; }
Implements the "stateless" part of the connection interface that is used by the
different objects in redis-rs. Primarily it obviously applies to Connection
object but also some other objects implement the interface (for instance
whole clients or certain redis results).
Generally clients and connections (as well as redis results of those) implement
this trait. Actual connections provide more functionality which can be used
to implement things like PubSub
but they also can modify the intrinsic
state of the TCP connection. This is not possible with ConnectionLike
implementors because that functionality is not exposed.
Required Methods
fn req_packed_command(&self, cmd: &[u8]) -> RedisResult<Value>
Sends an already encoded (packed) command into the TCP socket and reads the single response from it.
fn req_packed_commands(&self, cmd: &[u8], offset: usize, count: usize) -> RedisResult<Vec<Value>>
Sends multiple already encoded (packed) command into the TCP socket
and reads count
responses from it. This is used to implement
pipelining.
fn get_db(&self) -> i64
Returns the database this connection is bound to. Note that this information might be unreliable because it's initially cached and also might be incorrect if the connection like object is not actually connected.
Implementors
impl ConnectionLike for Client
impl ConnectionLike for Connection