Liking cljdoc? Tell your friends :D

taoensso.carmine.locks

Alpha - subject to change.
Distributed lock implementation for Carmine.
Based on work by Ronen Narkis and Josiah Carlson.

Redis keys:
  * carmine:lock:<lock-name> -> ttl str, lock owner's UUID.

Ref. <http://goo.gl/5UalQ> for implementation details.

acquire-lockclj

(acquire-lock conn-opts lock-name timeout-ms wait-ms)
Attempts to acquire a distributed lock, returning an owner UUID iff successful.
source

have-lock?clj

(have-lock? conn-opts lock-name owner-uuid)
source

release-lockclj

(release-lock conn-opts lock-name owner-uuid)
Attempts to release a distributed lock, returning true iff successful.
source

with-lockcljmacro

(with-lock conn-opts lock-name timeout-ms wait-ms & body)
Attempts to acquire a distributed lock, executing body and then releasing
lock when successful. Returns {:result <body's result>} on successful release,
or nil if the lock could not be acquired. If the lock is successfully acquired
but expires before being released, throws an exception.
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close