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-lock conn-opts lock-name timeout-ms wait-ms)
Attempts to acquire a distributed lock, returning an owner UUID iff successful.
(release-lock conn-opts lock-name owner-uuid)
Attempts to release a distributed lock, returning true iff successful.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close