[]Trait r2d2_redis_cluster::ConnectionLike

pub trait ConnectionLike {
    pub fn req_packed_command(
        &mut self,
        cmd: &[u8]
    ) -> Result<Value, RedisError>;
pub fn req_packed_commands(
        &mut self,
        cmd: &[u8],
        offset: usize,
        count: usize
    ) -> Result<Vec<Value, Global>, RedisError>;
pub 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

pub fn req_packed_command(&mut self, cmd: &[u8]) -> Result<Value, RedisError>

Sends an already encoded (packed) command into the TCP socket and reads the single response from it.

pub fn req_packed_commands(
    &mut self,
    cmd: &[u8],
    offset: usize,
    count: usize
) -> Result<Vec<Value, Global>, RedisError>

Sends multiple already encoded (packed) command into the TCP socket and reads count responses from it. This is used to implement pipelining.

pub 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.

Loading content...

Implementations on Foreign Types

impl ConnectionLike for Connection[src]

impl ConnectionLike for Connection

impl ConnectionLike for Client

Loading content...

Implementors

Loading content...