Attempts to acquire the lock named key.
The lock name.
Lifetime of the lock in milliseconds; after this it expires and may be acquired by others.
A unique fencing token to pass to release on success, or null if the lock is currently held.
Releases a lock previously acquired with acquire.
The lock name.
The token returned by the matching acquire call.
Distributed mutual-exclusion lock with fencing tokens and TTL-based expiry.
Remarks
Locks are used to serialize work that must not run concurrently across nodes (for example, ensuring a single owner processes a room). Each successful acquisition returns a unique token that must be presented to release, preventing one holder from releasing another's lock. Locks auto-expire after their TTL so a crashed holder cannot block others forever. The default in-process implementation is MemoryLock; production deployments can supply a Redis-backed adapter. Use noopLock to disable locking.