pub struct ConnectionConfig { /* private fields */ }Expand description
Configuration shared by Redis connection constructors.
The default matches RedisConnection::connect: standard TCP keepalive,
no connect timeout, automatic RESP3 negotiation with RESP2 fallback, and
RespLimits::default decode limits. Builder methods can be combined
without adding a constructor for every possible option matrix.
use redis_tower_core::{ConnectionConfig, ProtocolVersion, RespLimits};
use std::time::Duration;
let config = ConnectionConfig::new()
.with_connect_timeout(Some(Duration::from_secs(3)))
.with_protocol(ProtocolVersion::Resp3)
.with_resp_limits(RespLimits {
max_frame_size: 8 * 1024 * 1024,
max_depth: 32,
});
assert_eq!(config.protocol(), ProtocolVersion::Resp3);Implementations§
Source§impl ConnectionConfig
impl ConnectionConfig
Sourcepub fn new() -> ConnectionConfig
pub fn new() -> ConnectionConfig
Create a connection configuration with the default settings.
Sourcepub fn with_keepalive(self, keepalive: KeepaliveConfig) -> ConnectionConfig
pub fn with_keepalive(self, keepalive: KeepaliveConfig) -> ConnectionConfig
Set the TCP keepalive configuration.
Sourcepub fn with_connect_timeout(self, timeout: Option<Duration>) -> ConnectionConfig
pub fn with_connect_timeout(self, timeout: Option<Duration>) -> ConnectionConfig
Set or clear the connection-establishment timeout.
None uses the operating system’s connection timeout. Some applies
to the TCP or Unix-socket connect operation; a TLS handshake is not
included in this timeout.
Sourcepub fn with_protocol(self, protocol: ProtocolVersion) -> ConnectionConfig
pub fn with_protocol(self, protocol: ProtocolVersion) -> ConnectionConfig
Set the RESP protocol negotiation policy.
Sourcepub fn with_resp_limits(self, limits: RespLimits) -> ConnectionConfig
pub fn with_resp_limits(self, limits: RespLimits) -> ConnectionConfig
Set the resource limits enforced while decoding RESP frames.
Sourcepub fn keepalive(&self) -> &KeepaliveConfig
pub fn keepalive(&self) -> &KeepaliveConfig
Return the configured TCP keepalive settings.
Sourcepub fn connect_timeout(&self) -> Option<Duration>
pub fn connect_timeout(&self) -> Option<Duration>
Return the connection-establishment timeout.
Sourcepub fn protocol(&self) -> ProtocolVersion
pub fn protocol(&self) -> ProtocolVersion
Return the RESP protocol negotiation policy.
Sourcepub fn resp_limits(&self) -> RespLimits
pub fn resp_limits(&self) -> RespLimits
Return the configured RESP decode limits.
Trait Implementations§
Source§impl Clone for ConnectionConfig
impl Clone for ConnectionConfig
Source§fn clone(&self) -> ConnectionConfig
fn clone(&self) -> ConnectionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more