pub struct RedisLockState {
pub key: String,
pub lock_id: String,
pub timeouts: RedLockTimeouts,
}Expand description
Internal state for a Redis lock.
Fields§
§key: StringRedis key for the lock.
lock_id: StringUnique lock ID for this acquisition.
timeouts: RedLockTimeoutsTimeout configuration.
Implementations§
Source§impl RedisLockState
impl RedisLockState
Sourcepub fn new(key: String, timeouts: RedLockTimeouts) -> Self
pub fn new(key: String, timeouts: RedLockTimeouts) -> Self
Creates a new lock state.
Sourcepub async fn try_acquire(&self, client: &RedisClient) -> LockResult<bool>
pub async fn try_acquire(&self, client: &RedisClient) -> LockResult<bool>
Attempts to acquire the lock on a single Redis client.
Sourcepub async fn try_extend(&self, client: &RedisClient) -> LockResult<bool>
pub async fn try_extend(&self, client: &RedisClient) -> LockResult<bool>
Attempts to extend the lock on a single Redis client.
Uses a Lua script to atomically verify ownership and extend TTL.
Sourcepub async fn try_release(&self, client: &RedisClient) -> LockResult<()>
pub async fn try_release(&self, client: &RedisClient) -> LockResult<()>
Attempts to release the lock on a single Redis client.
Uses a Lua script to atomically verify ownership before deleting.
Trait Implementations§
Source§impl Clone for RedisLockState
impl Clone for RedisLockState
Source§fn clone(&self) -> RedisLockState
fn clone(&self) -> RedisLockState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RedisLockState
impl RefUnwindSafe for RedisLockState
impl Send for RedisLockState
impl Sync for RedisLockState
impl Unpin for RedisLockState
impl UnwindSafe for RedisLockState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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