pub struct RedisConnection { /* private fields */ }Expand description
A connection to a Redis server
Implementations§
Source§impl RedisConnection
impl RedisConnection
Sourcepub async fn connect(
host: &str,
port: u16,
config: ConnectionConfig,
) -> RedisResult<Self>
pub async fn connect( host: &str, port: u16, config: ConnectionConfig, ) -> RedisResult<Self>
Connect to a Redis server
Sourcepub async fn send_command(&mut self, command: &RespValue) -> RedisResult<()>
pub async fn send_command(&mut self, command: &RespValue) -> RedisResult<()>
Send a command to the server
Sourcepub async fn execute_command(
&mut self,
command: &str,
args: &[RespValue],
) -> RedisResult<RespValue>
pub async fn execute_command( &mut self, command: &str, args: &[RespValue], ) -> RedisResult<RespValue>
Execute a command and return the response
Sourcepub async fn read_response(&mut self) -> RedisResult<RespValue>
pub async fn read_response(&mut self) -> RedisResult<RespValue>
Read a complete RESP response from the connection
Sourcepub async fn detect_topology(&mut self) -> RedisResult<TopologyType>
pub async fn detect_topology(&mut self) -> RedisResult<TopologyType>
Detect the topology type of the Redis server
Sourcepub async fn select_database(&mut self, db: u8) -> RedisResult<()>
pub async fn select_database(&mut self, db: u8) -> RedisResult<()>
Select a database (only works in standalone mode)
Trait Implementations§
Source§impl ProtocolConnection for RedisConnection
impl ProtocolConnection for RedisConnection
Source§fn send_command<'life0, 'life1, 'async_trait>(
&'life0 mut self,
command: &'life1 RespValue,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_command<'life0, 'life1, 'async_trait>(
&'life0 mut self,
command: &'life1 RespValue,
) -> Pin<Box<dyn Future<Output = RedisResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a command to the server
Source§fn read_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = RedisResult<RespValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_response<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = RedisResult<RespValue>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read a response from the server
Auto Trait Implementations§
impl !Freeze for RedisConnection
impl RefUnwindSafe for RedisConnection
impl Send for RedisConnection
impl Sync for RedisConnection
impl Unpin for RedisConnection
impl UnwindSafe for RedisConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more