pub struct RedisConfig {
pub url: String,
pub username: Option<String>,
pub password: Option<String>,
pub connection_timeout: Duration,
pub key_prefix: String,
}Expand description
Configuration for Redis connection.
Fields§
§url: StringRedis connection URL (e.g., “redis://127.0.0.1:6379/”)
username: Option<String>Optional username for Redis authentication
password: Option<String>Optional password for Redis authentication
connection_timeout: DurationConnection timeout in seconds
key_prefix: StringKey prefix for Redis keys to avoid collisions
Implementations§
Source§impl RedisConfig
impl RedisConfig
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Create a new Redis configuration with the given URL.
Sourcepub fn with_username(self, username: impl Into<String>) -> Self
pub fn with_username(self, username: impl Into<String>) -> Self
Set the username for Redis authentication.
Sourcepub fn with_password(self, password: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<String>) -> Self
Set the password for Redis authentication.
Sourcepub fn with_connection_timeout(self, timeout: Duration) -> Self
pub fn with_connection_timeout(self, timeout: Duration) -> Self
Set the connection timeout.
Sourcepub fn with_key_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_key_prefix(self, prefix: impl Into<String>) -> Self
Set the key prefix for Redis keys.
Trait Implementations§
Source§impl Clone for RedisConfig
impl Clone for RedisConfig
Source§fn clone(&self) -> RedisConfig
fn clone(&self) -> RedisConfig
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 moreAuto Trait Implementations§
impl Freeze for RedisConfig
impl RefUnwindSafe for RedisConfig
impl Send for RedisConfig
impl Sync for RedisConfig
impl Unpin for RedisConfig
impl UnwindSafe for RedisConfig
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