pub struct RedisPools { /* private fields */ }Expand description
多个命名 Redis 连接的容器。
Implementations§
Source§impl RedisPools
impl RedisPools
Sourcepub async fn from_config(cfg: &Config) -> Result<Self>
pub async fn from_config(cfg: &Config) -> Result<Self>
为配置里声明的每个 [redis.<名字>] 建立连接。
Sourcepub fn get(&self, name: impl IntoRedisName) -> Option<ConnectionManager>
pub fn get(&self, name: impl IntoRedisName) -> Option<ConnectionManager>
按名取连接(克隆出一份句柄,底层连接共享)。
Sourcepub fn require(&self, name: impl IntoRedisName) -> Result<ConnectionManager>
pub fn require(&self, name: impl IntoRedisName) -> Result<ConnectionManager>
按名取连接,不存在时报错。
Sourcepub fn default(&self) -> Result<ConnectionManager>
pub fn default(&self) -> Result<ConnectionManager>
获取默认连接(名字为 “default”)。
Auto Trait Implementations§
impl !RefUnwindSafe for RedisPools
impl !UnwindSafe for RedisPools
impl Freeze for RedisPools
impl Send for RedisPools
impl Sync for RedisPools
impl Unpin for RedisPools
impl UnsafeUnpin for RedisPools
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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