Acquiring a lock for a certain resource, identifiable by the lock's key.
unique business transaction id to trace calls across components.
the key to identify the lock by.
the lock's time-to-live.
the acquisition's retry interval.
the function to call once the lock has been acquired. Will be called with an error if one is raised. If the retry interval times out, a ConflictException will be returned.
Closes component and frees used resources.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Configures component by passing configuration parameters.
configuration parameters to be set.
Checks if the component is opened.
true if the component has been opened and false otherwise.
Opens the component.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Releases prevously acquired lock by its key.
(optional) transaction id to trace execution through call chain.
a unique lock key to release.
callback function that receives error or null for success.
Sets references to dependent components.
references to locate the component dependencies.
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
Distributed lock that implemented based on Memcaches caching service.
The current implementation does not support authentication.
Configuration parameters
References
*:discovery:*:*:1.0
(optional) IDiscovery services to resolve connectionExample
let lock = new MemcachedLock(); lock.configure(ConfigParams.fromTuples( "host", "localhost", "port", 11211 )); lock.open("123", (err) => { ... }); lock.acquire("123", "key1", (err) => { if (err == null) { try { // Processing... } finally { lock.releaseLock("123", "key1", (err) => { // Continue... }); } } });