pub struct RedisConfig {
pub host: String,
pub port: u16,
pub username: String,
pub password: String,
pub database: u32,
pub max_connections: usize,
pub connect_timeout: Duration,
pub command_timeout: Duration,
}Fields§
§host: String§port: u16§username: StringRedis 6 ACL username. Empty means the legacy single-password mode.
password: String§database: u32The numbered database SELECTed after connecting.
max_connections: usizeConnections the pool will open at once.
connect_timeout: Duration§command_timeout: DurationHow long one command may take before the connection is given up on.
Implementations§
Source§impl RedisConfig
impl RedisConfig
Sourcepub fn from_url(url: &str) -> Result<Self>
pub fn from_url(url: &str) -> Result<Self>
Parse redis://[[user]:password@]host[:port][/db].
The password-only form redis://:secret@host is the one almost every
deployment uses, so it is handled first-class rather than as a special
case of a username.
Sourcepub fn from_app_config(config: &Config) -> Result<Self>
pub fn from_app_config(config: &Config) -> Result<Self>
Read from the application config, falling back to REDIS_URL.
pub fn address(&self) -> String
Sourcepub fn redacted_url(&self) -> String
pub fn redacted_url(&self) -> String
The URL with the password removed, for logs and error messages.
Every message this crate produces about a connection uses this, so a stack trace on a shared screen never leaks a credential.
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 (const: unstable) · 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 RedisConfig
impl Debug for RedisConfig
Auto Trait Implementations§
impl Freeze for RedisConfig
impl RefUnwindSafe for RedisConfig
impl Send for RedisConfig
impl Sync for RedisConfig
impl Unpin for RedisConfig
impl UnsafeUnpin 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