pub struct RedisDistributedSemaphore { /* private fields */ }Expand description
A Redis-based distributed semaphore.
Uses Redis sorted sets to track semaphore tickets. Each ticket has an expiry time, and expired tickets are automatically purged before acquisition attempts.
Trait Implementations§
Source§impl DistributedSemaphore for RedisDistributedSemaphore
impl DistributedSemaphore for RedisDistributedSemaphore
Source§type Handle = RedisSemaphoreHandle
type Handle = RedisSemaphoreHandle
Handle type for semaphore tickets.
Source§async fn acquire(
&self,
timeout: Option<Duration>,
) -> Result<<RedisDistributedSemaphore as DistributedSemaphore>::Handle, LockError>
async fn acquire( &self, timeout: Option<Duration>, ) -> Result<<RedisDistributedSemaphore as DistributedSemaphore>::Handle, LockError>
Acquires a semaphore ticket. Read more
Source§async fn try_acquire(
&self,
) -> Result<Option<<RedisDistributedSemaphore as DistributedSemaphore>::Handle>, LockError>
async fn try_acquire( &self, ) -> Result<Option<<RedisDistributedSemaphore as DistributedSemaphore>::Handle>, LockError>
Attempts to acquire a ticket without waiting.
Auto Trait Implementations§
impl Freeze for RedisDistributedSemaphore
impl !RefUnwindSafe for RedisDistributedSemaphore
impl Send for RedisDistributedSemaphore
impl Sync for RedisDistributedSemaphore
impl Unpin for RedisDistributedSemaphore
impl !UnwindSafe for RedisDistributedSemaphore
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