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.
Auto Trait Implementations§
impl<T> Freeze for Builder<T>
impl<T> RefUnwindSafe for Builder<T>where
T: RefUnwindSafe,
impl<T> Send for Builder<T>where
T: Send,
impl<T> Sync for Builder<T>where
T: Sync,
impl<T> Unpin for Builder<T>where
T: Unpin,
impl<T> UnwindSafe for Builder<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more