pub struct RedisCluster { /* private fields */ }Expand description
A set of connections maintained to a Redis Cluster with key cache.
Implementationsยง
Sourceยงimpl RedisCluster
impl RedisCluster
Sourcepub fn new(
cluster: StreamerUri,
options: Arc<RedisConnectOptions>,
) -> RedisResult<Self>
pub fn new( cluster: StreamerUri, options: Arc<RedisConnectOptions>, ) -> RedisResult<Self>
Nothing happens until you call connect
pub fn protocol(&self) -> Option<&str>
Sourcepub async fn reconnect_all(&mut self) -> RedisResult<()>
pub async fn reconnect_all(&mut self) -> RedisResult<()>
Will drop all existing connections. This method returns OK only if it can connect to all nodes.
Sourcepub fn reconnect(&mut self, node: &NodeId) -> RedisResult<()>
pub fn reconnect(&mut self, node: &NodeId) -> RedisResult<()>
An error has occured on the connection. Attempt to reconnect later.
Sourcepub fn node_for(&self, key: &str) -> &NodeId
pub fn node_for(&self, key: &str) -> &NodeId
Get the cached node for this key. There is no guarantee that the key assignment is right.
Sourcepub fn moved(&mut self, key: &str, node: NodeId)
pub fn moved(&mut self, key: &str, node: NodeId)
Indicate that the particular key has been moved to a different node in the cluster.
Sourcepub fn get_any(&mut self) -> RedisResult<(&NodeId, &mut MultiplexedConnection)>
pub fn get_any(&mut self) -> RedisResult<(&NodeId, &mut MultiplexedConnection)>
Get any available connection to the cluster
Sourcepub async fn get(
&mut self,
node: &NodeId,
) -> RedisResult<&mut MultiplexedConnection>
pub async fn get( &mut self, node: &NodeId, ) -> RedisResult<&mut MultiplexedConnection>
Get a connection to the specific node, will wait and retry a few times until dead.
Sourcepub async fn get_connection_for(
&mut self,
key: &str,
) -> RedisResult<(&NodeId, &mut MultiplexedConnection)>
pub async fn get_connection_for( &mut self, key: &str, ) -> RedisResult<(&NodeId, &mut MultiplexedConnection)>
Get a connection that is assigned with the specific key, will wait and retry a few times until dead. There is no guarantee that the key assignment is right.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for RedisCluster
impl RefUnwindSafe for RedisCluster
impl Send for RedisCluster
impl Sync for RedisCluster
impl Unpin for RedisCluster
impl UnwindSafe for RedisCluster
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