pub struct ConnectionConfig {
pub connection_string: String,
pub password: Option<String>,
pub database: u8,
pub connect_timeout: Duration,
pub operation_timeout: Duration,
pub tcp_keepalive: Option<Duration>,
pub topology_mode: TopologyMode,
pub pool: PoolConfig,
pub max_redirects: usize,
pub protocol_version: ProtocolVersion,
pub sentinel: Option<SentinelConfig>,
pub reconnect: ReconnectConfig,
}Expand description
Configuration for Redis connection
Fields§
§connection_string: StringConnection string (e.g., <redis://localhost:6379> or <redis://host1:6379,host2:6379>)
password: Option<String>Optional password for authentication
database: u8Database number (only for standalone mode)
connect_timeout: DurationConnection timeout
operation_timeout: DurationRead/write operation timeout
tcp_keepalive: Option<Duration>Enable TCP keepalive
topology_mode: TopologyModeTopology detection mode
pool: PoolConfigPool configuration
max_redirects: usizeMaximum number of retries for cluster redirects
protocol_version: ProtocolVersionPreferred protocol version
sentinel: Option<SentinelConfig>Sentinel configuration for high availability
reconnect: ReconnectConfigReconnection settings
Implementations§
Source§impl ConnectionConfig
Extension trait for ConnectionConfig to support Sentinel
impl ConnectionConfig
Extension trait for ConnectionConfig to support Sentinel
Sourcepub fn new_with_sentinel(sentinel_config: SentinelConfig) -> Self
pub fn new_with_sentinel(sentinel_config: SentinelConfig) -> Self
Create a new connection config with Sentinel
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn new(connection_string: impl Into<String>) -> Self
pub fn new(connection_string: impl Into<String>) -> Self
Create a new configuration with the given connection string
Sourcepub fn with_password(self, password: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<String>) -> Self
Set the password for authentication
Sourcepub const fn with_database(self, database: u8) -> Self
pub const fn with_database(self, database: u8) -> Self
Set the database number
Sourcepub const fn with_connect_timeout(self, timeout: Duration) -> Self
pub const fn with_connect_timeout(self, timeout: Duration) -> Self
Set the connection timeout
Sourcepub const fn with_operation_timeout(self, timeout: Duration) -> Self
pub const fn with_operation_timeout(self, timeout: Duration) -> Self
Set the operation timeout
Sourcepub const fn with_topology_mode(self, mode: TopologyMode) -> Self
pub const fn with_topology_mode(self, mode: TopologyMode) -> Self
Set the topology mode
Sourcepub const fn with_pool_config(self, pool: PoolConfig) -> Self
pub const fn with_pool_config(self, pool: PoolConfig) -> Self
Set the pool configuration
Sourcepub const fn with_max_redirects(self, max: usize) -> Self
pub const fn with_max_redirects(self, max: usize) -> Self
Set the maximum number of redirects
Sourcepub const fn with_protocol_version(self, version: ProtocolVersion) -> Self
pub const fn with_protocol_version(self, version: ProtocolVersion) -> Self
Set the preferred protocol version
Sourcepub fn parse_endpoints(&self) -> Vec<(String, u16)>
pub fn parse_endpoints(&self) -> Vec<(String, u16)>
Parse connection endpoints from connection string
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more