pub struct RedisService { /* private fields */ }Implementations§
Source§impl RedisService
impl RedisService
Sourcepub fn new(url: &str) -> Result<Self>
pub fn new(url: &str) -> Result<Self>
Create a new Redis service with a custom URL (e.g. “redis://localhost:6379”)
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create a Redis service, reading the URL from MECHA10_REDIS_URL, then
REDIS_URL, defaulting to “redis://localhost:6379”.
Sourcepub async fn get_connection(&self) -> Result<RedisConnection>
pub async fn get_connection(&self) -> Result<RedisConnection>
Get a new async Redis connection. For long-running operations, consider caching the connection instead of calling this repeatedly.
Sourcepub async fn get_multiplexed_connection(&self) -> Result<MultiplexedConnection>
pub async fn get_multiplexed_connection(&self) -> Result<MultiplexedConnection>
Get a multiplexed async Redis connection, allowing multiple concurrent operations on the same connection.
Sourcepub async fn check_health(&self, timeout: Duration) -> bool
pub async fn check_health(&self, timeout: Duration) -> bool
Connect and PING within timeout; true if Redis responds, false otherwise.
Sourcepub async fn is_healthy(&self) -> bool
pub async fn is_healthy(&self) -> bool
Check health with default timeout (2 seconds)
Trait Implementations§
Source§impl Debug for RedisService
impl Debug for RedisService
Auto Trait Implementations§
impl Freeze for RedisService
impl RefUnwindSafe for RedisService
impl Send for RedisService
impl Sync for RedisService
impl Unpin for RedisService
impl UnsafeUnpin for RedisService
impl UnwindSafe for RedisService
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