pub struct ClientOptions {
pub host: String,
pub port: u16,
pub username: Option<String>,
pub password: Option<String>,
pub database: u32,
pub connect_timeout: Duration,
pub discover_cluster: bool,
pub reconnect: bool,
pub max_reconnect_attempts: u32,
pub reconnect_base_delay: Duration,
pub reconnect_max_delay: Duration,
}Expand description
Where to connect, and an optional password sent as AUTH.
Fields§
§host: StringServer host. Defaults to loopback.
port: u16RESP port. Defaults to 6379.
username: Option<String>ACL user. When set together with Self::password, the client sends AUTH user password.
password: Option<String>When set, the client sends AUTH before Client::connect_with returns.
database: u32Logical database. When not 0, the client sends SELECT after AUTH.
connect_timeout: DurationHow long TCP connect may take.
discover_cluster: boolWhen true (the default), connect sends CLUSTER SLOTS. A slot map turns
the client into a router; a disabled-cluster error keeps one socket.
reconnect: boolWhen true (the default), a broken socket is opened again before the next command.
The command that discovers the drop still fails. Set this to false and call
Client::reconnect on your own schedule.
max_reconnect_attempts: u32How many connect attempts a reconnect makes before giving up. One is a single try.
reconnect_base_delay: DurationFirst automatic wait after a failed reconnect attempt.
reconnect_max_delay: DurationCeiling for the automatic exponential wait.