Liking cljdoc? Tell your friends :D

omega-red.lock


createclj

(create {:keys [lock-key lock-id expiry-ms acquire-timeout-ms
                acquire-resolution-ms release-on-stop?]
         :or {release-on-stop? true
              expiry-ms default-expiry-ms
              acquire-timeout-ms default-acquire-timeout-ms
              acquire-resolution-ms default-acquire-resolution-ms}})
source

create-mockclj

(create-mock {:keys [always-acquire?] :or {always-acquire? true}})

Creates a mock RedLock implementation for testing purposes. Options:

  • :always-acquire? - if true, acquire and acquire-with-timeout will always succeed (default: true)
Creates a mock RedLock implementation for testing purposes.
Options:
- `:always-acquire?` - if true, `acquire` and `acquire-with-timeout` will always succeed (default: true)
sourceraw docstring

get-lock-holder-id*clj

(get-lock-holder-id* conn {:keys [lock-key]})
source

lock-expiry-in-ms*clj

(lock-expiry-in-ms* conn {:keys [lock-key]})
source

lock-scriptclj

source

RedLockcljprotocol

acquireclj

(acquire this)
(acquire this opts)

Acquire the lock. Returns true if acquired, false otherwise. If this instance already holds the lock, acquiring again succeeds and refreshes the expiry.

Acquire the lock. Returns true if acquired, false otherwise.
If this instance already holds the lock, acquiring again succeeds and refreshes the expiry.

acquire-with-timeoutclj

(acquire-with-timeout this)
(acquire-with-timeout this opts)

Like acquire but will wait for the lock to be available up to acquire-timeout-ms milliseconds. If the lock is not acquired within that time, returns false.

Like `acquire` but will wait for the lock to be available up to `acquire-timeout-ms` milliseconds.
If the lock is not acquired within that time, returns false.

get-idclj

(get-id this)

Returns the lock ID of this instance, regardless of whether it holds the lock.

Returns the lock ID of this instance, regardless of whether it holds the lock.

get-lock-holder-idclj

(get-lock-holder-id this)

Returns the lock ID of the current lock holder, nil if the lock is not held.

Returns the lock ID of the current lock holder, nil if the lock is not held.

is-lock-holder?clj

(is-lock-holder? this)

Check if this instance is the lock holder. Returns true if it is, false otherwise.

Check if this instance is the lock holder. Returns true if it is, false otherwise.

lock-expiry-in-msclj

(lock-expiry-in-ms this)

Returns number of milliseconds until the lock expires. If the lock doesn't exist, the result is negative - don't rely on it to check if the lock is held, use is-lock-holder? instead.

Returns number of milliseconds until the lock expires.
If the lock doesn't exist, the result is negative - don't rely on it to check if the lock is held, use `is-lock-holder?` instead.

releaseclj

(release this)

Release the lock. Always returns true, even if this instance was not the lock holder.

Release the lock. Always returns true, even if this instance was not the lock holder.

renewclj

(renew this)

Renew the lock. Returns true if renewed, false otherwise.

Renew the lock. Returns true if renewed, false otherwise.
source

release*clj

(release* conn {:keys [lock-key lock-id expiry-ms]})
source

release-scriptclj

source

renew*clj

(renew* conn {:keys [lock-key lock-id expiry-ms]})
source

renew-scriptclj

source

try-acquire*clj

(try-acquire* conn {:keys [lock-key lock-id expiry-ms]})

Try acquiring a lock, doesn't use timeouts - so it either acquires the lock or fails immediately. Returns true if acquired, false otherwise.

Try acquiring a lock, doesn't use timeouts - so it either acquires the lock or fails immediately.
Returns true if acquired, false otherwise.
sourceraw docstring

try-acquire-with-timeout*clj

(try-acquire-with-timeout* conn
                           {:keys [lock-key lock-id expiry-ms acquire-timeout-ms
                                   acquire-resolution-ms]})

Try acquiring a lock, with a timeout options

Try acquiring a lock, with a timeout options
sourceraw docstring

with-lockcljmacro

(with-lock lock & body)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close