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 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
reconnect: ReconnectConfigReconnection settings
Implementations§
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 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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionConfig
impl Debug for ConnectionConfig
Auto Trait Implementations§
impl Freeze for ConnectionConfig
impl RefUnwindSafe for ConnectionConfig
impl Send for ConnectionConfig
impl Sync for ConnectionConfig
impl Unpin for ConnectionConfig
impl UnwindSafe for ConnectionConfig
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
Mutably borrows from an owned value. Read more