pub struct ClusterClient { /* private fields */ }cluster only.Expand description
A Redis Cluster client, used to create connections.
Implementations§
Source§impl ClusterClient
impl ClusterClient
Sourcepub fn new<T: IntoConnectionInfo>(
initial_nodes: impl IntoIterator<Item = T>,
) -> RedisResult<ClusterClient>
pub fn new<T: IntoConnectionInfo>( initial_nodes: impl IntoIterator<Item = T>, ) -> RedisResult<ClusterClient>
Creates a ClusterClient with the default parameters.
This does not create connections to the Redis Cluster, but only performs some basic checks on the initial nodes’ URLs and passwords/usernames.
§Errors
Upon failure to parse initial nodes or if the initial nodes have different passwords or usernames, an error is returned.
Sourcepub fn builder<T: IntoConnectionInfo>(
initial_nodes: impl IntoIterator<Item = T>,
) -> ClusterClientBuilder
pub fn builder<T: IntoConnectionInfo>( initial_nodes: impl IntoIterator<Item = T>, ) -> ClusterClientBuilder
Creates a ClusterClientBuilder with the provided initial_nodes.
Sourcepub fn get_connection(&self) -> RedisResult<ClusterConnection>
pub fn get_connection(&self) -> RedisResult<ClusterConnection>
Creates new connections to Redis Cluster nodes and returns a
cluster::ClusterConnection.
§Errors
An error is returned if there is a failure while creating connections or slots.
Sourcepub fn get_connection_with_config(
&self,
config: ClusterConfig,
) -> RedisResult<ClusterConnection>
pub fn get_connection_with_config( &self, config: ClusterConfig, ) -> RedisResult<ClusterConnection>
Creates new connections to Redis Cluster nodes with a custom config and returns a
cluster_async::ClusterConnection.
§Errors
An error is returned if there is a failure while creating connections or slots.
Sourcepub async fn get_async_connection(&self) -> RedisResult<ClusterConnection>
Available on crate feature cluster-async only.
pub async fn get_async_connection(&self) -> RedisResult<ClusterConnection>
cluster-async only.Creates new connections to Redis Cluster nodes and returns a
cluster_async::ClusterConnection.
§Errors
An error is returned if there is a failure while creating connections or slots.
Sourcepub async fn get_async_connection_with_config(
&self,
config: ClusterConfig,
) -> RedisResult<ClusterConnection>
Available on crate feature cluster-async only.
pub async fn get_async_connection_with_config( &self, config: ClusterConfig, ) -> RedisResult<ClusterConnection>
cluster-async only.Creates new connections to Redis Cluster nodes with a custom config and returns a
cluster_async::ClusterConnection.
§Errors
An error is returned if there is a failure while creating connections or slots.
Sourcepub fn get_pending_async_connection_with_config(
&self,
config: ClusterConfig,
) -> ClusterConnection
Available on crate feature cluster-async only.
pub fn get_pending_async_connection_with_config( &self, config: ClusterConfig, ) -> ClusterConnection
cluster-async only.Creates new connections to Redis Cluster nodes with a custom config and returns a
cluster_async::ClusterConnection. The connections to the cluster nodes are done in the
background so the caller won’t know if the cluster is available until the first command is sent.
Trait Implementations§
Source§impl Clone for ClusterClient
impl Clone for ClusterClient
Source§fn clone(&self) -> ClusterClient
fn clone(&self) -> ClusterClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ManageConnection for ClusterClient
Available on crate feature r2d2 only.
impl ManageConnection for ClusterClient
r2d2 only.Source§type Connection = ClusterConnection
type Connection = ClusterConnection
Source§type Error = RedisError
type Error = RedisError
Connections.Source§fn connect(&self) -> Result<Self::Connection, Self::Error>
fn connect(&self) -> Result<Self::Connection, Self::Error>
Source§fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>
fn is_valid(&self, conn: &mut Self::Connection) -> Result<(), Self::Error>
Source§fn has_broken(&self, conn: &mut Self::Connection) -> bool
fn has_broken(&self, conn: &mut Self::Connection) -> bool
Source§impl ManageConnection for ClusterClient
Available on crate features bb8 and aio only.
impl ManageConnection for ClusterClient
bb8 and aio only.Source§type Connection = ClusterConnection
type Connection = ClusterConnection
Source§type Error = RedisError
type Error = RedisError
Connections.