pub struct RedisConfigBuilder {
pub host: String,
pub port: u16,
pub db: i64,
pub username: Option<String>,
pub password: Option<String>,
pub use_tls: bool,
pub use_unix_socket: bool,
pub socket_path: Option<String>,
pub connection_timeout: Option<u64>,
}
Expand description
Redis connection configuration builder
This struct is used to build a Redis connection configuration. It follows the builder pattern to allow for flexible configuration.
Fields§
§host: String
§port: u16
§db: i64
§username: Option<String>
§password: Option<String>
§use_tls: bool
§use_unix_socket: bool
§socket_path: Option<String>
§connection_timeout: Option<u64>
Implementations§
Source§impl RedisConfigBuilder
impl RedisConfigBuilder
Sourcepub fn username(self, username: &str) -> Self
pub fn username(self, username: &str) -> Self
Set the username for the Redis connection (Redis 6.0+)
Sourcepub fn use_unix_socket(self, use_unix_socket: bool) -> Self
pub fn use_unix_socket(self, use_unix_socket: bool) -> Self
Use Unix socket for the Redis connection
Sourcepub fn socket_path(self, socket_path: &str) -> Self
pub fn socket_path(self, socket_path: &str) -> Self
Set the Unix socket path for the Redis connection
Sourcepub fn connection_timeout(self, seconds: u64) -> Self
pub fn connection_timeout(self, seconds: u64) -> Self
Set the connection timeout in seconds
Sourcepub fn build_connection_url(&self) -> String
pub fn build_connection_url(&self) -> String
Build the connection URL from the configuration
Sourcepub fn build(&self) -> RedisResult<(Client, i64)>
pub fn build(&self) -> RedisResult<(Client, i64)>
Build a Redis client from the configuration
Trait Implementations§
Source§impl Clone for RedisConfigBuilder
impl Clone for RedisConfigBuilder
Source§fn clone(&self) -> RedisConfigBuilder
fn clone(&self) -> RedisConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for RedisConfigBuilder
impl RefUnwindSafe for RedisConfigBuilder
impl Send for RedisConfigBuilder
impl Sync for RedisConfigBuilder
impl Unpin for RedisConfigBuilder
impl UnwindSafe for RedisConfigBuilder
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