pub struct InMemoryDistributedLocker { /* private fields */ }Expand description
An in-process reference DistributedLocker.
Share one instance (via Arc) between several caches to get cross-instance
single-flight within one process. A real cluster uses a Redis-backed locker.
Implementations§
Trait Implementations§
Source§impl DistributedLocker for InMemoryDistributedLocker
impl DistributedLocker for InMemoryDistributedLocker
Source§fn acquire<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
timeout: Timeout,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn acquire<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
ttl: Duration,
timeout: Timeout,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn release<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn release<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
token: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Releases a previously-acquired lock. Releasing a token that is no longer
held (e.g. it already expired) is a no-op, not an error. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryDistributedLocker
impl !UnwindSafe for InMemoryDistributedLocker
impl Freeze for InMemoryDistributedLocker
impl Send for InMemoryDistributedLocker
impl Sync for InMemoryDistributedLocker
impl Unpin for InMemoryDistributedLocker
impl UnsafeUnpin for InMemoryDistributedLocker
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