Struct redis::cluster::ClusterClientBuilder
source · pub struct ClusterClientBuilder { /* private fields */ }
cluster
only.Expand description
Used to configure and build a ClusterClient
.
Implementations§
source§impl ClusterClientBuilder
impl ClusterClientBuilder
sourcepub fn new<T: IntoConnectionInfo>(initial_nodes: Vec<T>) -> ClusterClientBuilder
pub fn new<T: IntoConnectionInfo>(initial_nodes: Vec<T>) -> ClusterClientBuilder
Creates a new ClusterClientBuilder
with the provided initial_nodes.
This is the same as ClusterClient::builder(initial_nodes)
.
sourcepub fn build(self) -> RedisResult<ClusterClient>
pub fn build(self) -> RedisResult<ClusterClient>
Creates a new ClusterClient
from the 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 password(self, password: String) -> ClusterClientBuilder
pub fn password(self, password: String) -> ClusterClientBuilder
Sets password for the new ClusterClient.
sourcepub fn username(self, username: String) -> ClusterClientBuilder
pub fn username(self, username: String) -> ClusterClientBuilder
Sets username for the new ClusterClient.
sourcepub fn retries(self, retries: u32) -> ClusterClientBuilder
pub fn retries(self, retries: u32) -> ClusterClientBuilder
Sets number of retries for the new ClusterClient.
sourcepub fn tls(self, tls: TlsMode) -> ClusterClientBuilder
pub fn tls(self, tls: TlsMode) -> ClusterClientBuilder
Sets TLS mode for the new ClusterClient.
It is extracted from the first node of initial_nodes if not set.
sourcepub fn read_from_replicas(self) -> ClusterClientBuilder
pub fn read_from_replicas(self) -> ClusterClientBuilder
Enables reading from replicas for all new connections (default is disabled).
If enabled, then read queries will go to the replica nodes & write queries will go to the primary nodes. If there are no replica nodes, then all queries will go to the primary nodes.
sourcepub fn open(self) -> RedisResult<ClusterClient>
👎Deprecated since 0.22.0: Use build()
pub fn open(self) -> RedisResult<ClusterClient>
Use build()
.
sourcepub fn readonly(self, read_from_replicas: bool) -> ClusterClientBuilder
👎Deprecated since 0.22.0: Use read_from_replicas()
pub fn readonly(self, read_from_replicas: bool) -> ClusterClientBuilder
Use read_from_replicas()
.