Lock that is used to synchronize execution within one process using shared memory.
Remember: This implementation is not suitable for synchronization of distributed processes.
- ### Configuration parameters ###
retry_timeout: timeout in milliseconds to retry lock acquisition. (Default: 100)
lock = MemoryLock() lock.acquire_lock("123", "key1", None, None) # processing lock.release_lock("123", "key1")
release_lock(correlation_id: Optional[str], key: str)
Releases the lock with the given key.
correlation_id – not user.
key – the key of the lock that is to be released.
try_acquire_lock(correlation_id: Optional[str], key: str, ttl: int)
Makes a single attempt to acquire a lock by its key.
It returns immediately a positive or negative result.
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
ttl – a lock timeout (time to live) in milliseconds.
receives a lock result.