pub struct MultiResourceLock { /* private fields */ }
Implementations§
source§impl MultiResourceLock
impl MultiResourceLock
sourcepub fn new(client: &Client) -> RedisResult<Self>
pub fn new(client: &Client) -> RedisResult<Self>
Create a new instance of the lock.
sourcepub fn acquire(
&mut self,
resources: &[String],
expiration: Duration,
timeout: Duration,
sleep: Duration,
) -> RedisResult<Option<String>>
pub fn acquire( &mut self, resources: &[String], expiration: Duration, timeout: Duration, sleep: Duration, ) -> RedisResult<Option<String>>
Attempts to acquire the lock blocking up to expiration
until the lock can be acquired.
sourcepub fn try_acquire(
&mut self,
resources: &[String],
expiration: Duration,
) -> RedisResult<Option<String>>
pub fn try_acquire( &mut self, resources: &[String], expiration: Duration, ) -> RedisResult<Option<String>>
Attempts to acquire the lock returning immediately if it cannot be immediately acquired.
sourcepub fn release(&mut self, lock_id: &str) -> RedisResult<usize>
pub fn release(&mut self, lock_id: &str) -> RedisResult<usize>
Releases a held lock.
sourcepub fn try_lock(
&mut self,
resources: &[String],
expiration: Duration,
) -> RedisResult<Option<MultiResourceGuard<'_>>>
pub fn try_lock( &mut self, resources: &[String], expiration: Duration, ) -> RedisResult<Option<MultiResourceGuard<'_>>>
Attempts to acquire the lock returning immediately if it cannot be immediately acquired.
sourcepub fn lock(
&mut self,
resources: &[String],
expiration: Duration,
timeout: Duration,
sleep: Duration,
) -> RedisResult<Option<MultiResourceGuard<'_>>>
pub fn lock( &mut self, resources: &[String], expiration: Duration, timeout: Duration, sleep: Duration, ) -> RedisResult<Option<MultiResourceGuard<'_>>>
Attempts to acquire the lock blocking up to expiration
until the lock can be acquired.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiResourceLock
impl !RefUnwindSafe for MultiResourceLock
impl Send for MultiResourceLock
impl Sync for MultiResourceLock
impl Unpin for MultiResourceLock
impl !UnwindSafe for MultiResourceLock
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