pub struct Config {Show 14 fields
pub server: ServerConfig,
pub username: Option<String>,
pub password: Option<String>,
pub database: usize,
pub tls_config: Option<TlsConfig>,
pub connect_timeout: Duration,
pub command_timeout: Duration,
pub auto_resubscribe: bool,
pub auto_remonitor: bool,
pub connection_name: String,
pub keep_alive: Option<Duration>,
pub no_delay: bool,
pub retry_on_error: bool,
pub reconnection: ReconnectionConfig,
}Expand description
Configuration options for a client
or a pooled client
Fields§
§server: ServerConfigConnection server configuration (standalone, sentinel, or cluster)
username: Option<String>An optional ACL username for authentication.
See ACL
password: Option<String>An optional password for authentication.
The password could be either coupled with an ACL username either used alone.
See:
database: usizeThe default database for this connection.
If database is not set to 0, a SELECT
command will be automatically issued at connection or reconnection.
tls_config: Option<TlsConfig>native-tls or rustls only.An optional TLS configuration.
connect_timeout: DurationThe time to attempt a connection before timing out. The default is 10 seconds
command_timeout: DurationIf a command does not return a reply within a set number of milliseconds, a timeout error will be thrown.
If set to 0, no timeout is apply
The default is 0
auto_resubscribe: boolWhen the client reconnects, channels subscribed in the previous connection will be
resubscribed automatically if auto_resubscribe is true.
The default is true
auto_remonitor: boolWhen the client reconnects, if in monitor mode, the
monitor command
will be resent automatically
The default is true
connection_name: StringSet the name of the connection to make it easier to identity the connection in client list.
See client_setname
keep_alive: Option<Duration>Enable/disable keep-alive functionality (default None)
no_delay: boolEnable/disable the use of Nagle’s algorithm (default true)
retry_on_error: boolDefines the default strategy for retries on network error (default false):
true- retry sending the command/batch of commands on network errorfalse- do not retry sending the command/batch of commands on network error
This strategy can be overriden for each command/batch of commands in the following functions:
reconnection: ReconnectionConfigReconnection policy configuration (Constant, Linear or Exponential)