pub struct RedisConnKey {
pub node: NodeSpec,
pub read_from_replicas: bool,
pub username: Option<String>,
pub password: Option<String>,
pub cluster: Option<bool>,
pub pool_size: Option<usize>,
pub connect_timeout: Option<Duration>,
pub recycle_timeout: Option<Duration>,
pub wait_timeout: Option<Duration>,
pub response_timeout: Option<Duration>,
}Fields§
§node: NodeSpec§read_from_replicas: boolEnables reading from replicas for all new connections
username: Option<String>§password: Option<String>§cluster: Option<bool>§pool_size: Option<usize>Maximum number of connections managed by the pool. Default is 10
connect_timeout: Option<Duration>§recycle_timeout: Option<Duration>§wait_timeout: Option<Duration>§response_timeout: Option<Duration>Implementations§
Source§impl RedisConnKey
impl RedisConnKey
pub fn build_client(&self) -> Result<ClientWrapper>
pub fn get_pool(&self) -> Result<Pool<ClientManager>>
pub fn open(&self) -> Result<RedisConnection>
Sourcepub fn hash_label(&self) -> String
pub fn hash_label(&self) -> String
Produces a human readable label string that is representitive of this RedisConnKey. We pull out the node and username to include in the label. Now, since the entire RedisConnKey is the actual key, that readable subset is not sufficient to uniquely identify the entry in the pool, although in reality it is probably OK, there exists the possibility that eg: on a config update, multiple entries have the same list of nodes but different auth or other parameters. To smooth over such a transition, we’ll include a basic crc32 of the entire RedisConnKey in the label that is returned. This will probably be sufficient to avoid an obvious collision between such names, but it will not guarantee it. This is a best effort really; I doubt that this will cause any meaningful issues in practice, as the intended use case for this label string is to sample metrics rather than to guarantee isolation.
Trait Implementations§
Source§impl Clone for RedisConnKey
impl Clone for RedisConnKey
Source§fn clone(&self) -> RedisConnKey
fn clone(&self) -> RedisConnKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RedisConnKey
impl Debug for RedisConnKey
Source§impl<'de> Deserialize<'de> for RedisConnKey
impl<'de> Deserialize<'de> for RedisConnKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for RedisConnKey
impl Hash for RedisConnKey
Source§impl PartialEq for RedisConnKey
impl PartialEq for RedisConnKey
impl Eq for RedisConnKey
impl StructuralPartialEq for RedisConnKey
Auto Trait Implementations§
impl Freeze for RedisConnKey
impl RefUnwindSafe for RedisConnKey
impl Send for RedisConnKey
impl Sync for RedisConnKey
impl Unpin for RedisConnKey
impl UnwindSafe for RedisConnKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more