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>
pub async fn get_async_connection(&self) -> RedisResult<ClusterConnection>
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>
pub async fn get_async_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 fn open<T: IntoConnectionInfo>(
initial_nodes: Vec<T>,
) -> RedisResult<ClusterClient>
👎Deprecated since 0.22.0: Use new()
pub fn open<T: IntoConnectionInfo>( initial_nodes: Vec<T>, ) -> RedisResult<ClusterClient>
Use new()
.
Trait Implementations§
Source§impl Clone for ClusterClient
impl Clone for ClusterClient
Source§fn clone(&self) -> ClusterClient
fn clone(&self) -> ClusterClient
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const 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
Connection
s.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
Connection
s.