pub struct Builder<T: IntoConnectionInfo> { /* private fields */ }Expand description
This is a Builder of Redis cluster client.
Implementations§
Source§impl<T: IntoConnectionInfo> Builder<T>
impl<T: IntoConnectionInfo> Builder<T>
Sourcepub fn new(initial_nodes: Vec<T>) -> Builder<T>
pub fn new(initial_nodes: Vec<T>) -> Builder<T>
Generate the base configuration for new Client.
Sourcepub fn open(self) -> RedisResult<Client>
pub fn open(self) -> RedisResult<Client>
Connect to a redis cluster server and return a cluster client. This does not actually open a connection yet but it performs some basic checks on the URL. The password of initial nodes must be the same all.
§Errors
If it is failed to parse initial_nodes or the initial nodes has different password, an error is returned.
Sourcepub fn readonly(self, readonly: bool) -> Builder<T>
pub fn readonly(self, readonly: bool) -> Builder<T>
Set read only mode for new Client. Default is not read only mode. When it is set to readonly mode, all query use replica nodes except there are no replica nodes. If there are no replica nodes, it use master node.
Sourcepub fn read_timeout(self, timeout: Option<Duration>) -> Builder<T>
pub fn read_timeout(self, timeout: Option<Duration>) -> Builder<T>
Set the read timeout for the connection.
If the provided value is None, then recv_response call will
block indefinitely. It is an error to pass the zero Duration to this
method.
Sourcepub fn write_timeout(self, timeout: Option<Duration>) -> Builder<T>
pub fn write_timeout(self, timeout: Option<Duration>) -> Builder<T>
Set the write timeout for the connection.
If the provided value is None, then send_packed_command call will
block indefinitely. It is an error to pass the zero Duration to this
method.