Trait redis::cluster::Connect

source ·
pub trait Connect: Sized {
    // Required methods
    fn connect<T>(info: T, timeout: Option<Duration>) -> RedisResult<Self>
       where T: IntoConnectionInfo;
    fn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>;
    fn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>;
    fn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>;
    fn recv_response(&mut self) -> RedisResult<Value>;
}
Available on crate feature cluster only.
Expand description

Implements the process of connecting to a Redis server and obtaining and configuring a connection handle.

Required Methods§

source

fn connect<T>(info: T, timeout: Option<Duration>) -> RedisResult<Self>where T: IntoConnectionInfo,

Connect to a node, returning handle for command execution.

source

fn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>

Sends an already encoded (packed) command into the TCP socket and does not read a response. This is useful for commands like MONITOR which yield multiple items. This needs to be used with care because it changes the state of the connection.

source

fn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>

Sets the write timeout for the connection.

If the provided value is None, then send_packed_command call will block indefinitely. It is an error to pass the zero Duration to this method.

source

fn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>

Sets the read timeout for the connection.

If the provided value is None, then recv_response call will block indefinitely. It is an error to pass the zero Duration to this method.

source

fn recv_response(&mut self) -> RedisResult<Value>

Fetches a single response from the connection. This is useful if used in combination with send_packed_command.

Implementors§