pub struct LockManager { /* private fields */ }Expand description
Mints Locks against a cache.
Bind one in the container and resolve it; a lock taken through a different cache is a different lock.
Implementations§
Source§impl LockManager
impl LockManager
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Locks under a different prefix.
Worth changing when the cache is shared with something else that might pick the same names.
Sourcepub fn lock(&self, name: impl Into<String>, ttl: Duration) -> Lock
pub fn lock(&self, name: impl Into<String>, ttl: Duration) -> Lock
A lock called name, held for at most ttl.
Whether locks taken here are visible to other processes.
false for an in-process cache, which means on_one_server is not
doing what its name says. Worth asserting at boot rather than
discovering from a report that ran twice.
let locks = LockManager::new(Arc::new(MemoryCache::new()));
assert!(!locks.is_shared());Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LockManager
impl !UnwindSafe for LockManager
impl Freeze for LockManager
impl Send for LockManager
impl Sync for LockManager
impl Unpin for LockManager
impl UnsafeUnpin for LockManager
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