pub struct Connection { /* private fields */ }
Expand description
A wrapped redis::aio::MultiplexedConnection
that can auto-reconnect.
Implementationsยง
Sourceยงimpl Connection
impl Connection
Sourcepub async fn create(
node: NodeId,
options: Arc<RedisConnectOptions>,
) -> RedisResult<Self>
pub async fn create( node: NodeId, options: Arc<RedisConnectOptions>, ) -> RedisResult<Self>
Create a connection; return error if failed.
Sourcepub async fn create_or_reconnect(
node: NodeId,
options: Arc<RedisConnectOptions>,
) -> RedisResult<Self>
pub async fn create_or_reconnect( node: NodeId, options: Arc<RedisConnectOptions>, ) -> RedisResult<Self>
Create a connection; but retry later if failed.
Sourcepub async fn get(&mut self) -> RedisResult<&mut MultiplexedConnection>
pub async fn get(&mut self) -> RedisResult<&mut MultiplexedConnection>
Get a mutable connection, will wait and retry a few times until dead.
Sourcepub fn try_get(&mut self) -> RedisResult<&mut MultiplexedConnection>
pub fn try_get(&mut self) -> RedisResult<&mut MultiplexedConnection>
Get a mutable connection, only if it is alive.
pub fn protocol(&self) -> &str
pub fn node_id(&self) -> &NodeId
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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