Makes multiple attempts to acquire a lock by its key within give time interval.
(optional) transaction id to trace execution through call chain.
a unique lock key to acquire.
a lock timeout (time to live) in milliseconds.
a lock acquisition timeout.
callback function that receives error or null for success.
Configures component by passing configuration parameters.
configuration parameters to be set.
Releases the lock with the given key.
not used.
the key of the lock that is to be released.
(optional) the function to call once the lock has been released. Will be called
with null
.
Makes a single attempt to acquire a lock by its key. It returns immediately a positive or negative result.
(optional) transaction id to trace execution through call chain.
a unique lock key to acquire.
a lock timeout (time to live) in milliseconds.
callback function that receives a lock result or error.
Generated using TypeDoc
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
ILock
Lock
Example
let lock = new MemoryLock(); lock.acquire("123", "key1", (err) => { if (err == null) { try { // Processing... } finally { lock.releaseLock("123", "key1", (err) => { // Continue... }); } } });