(_acquire-lock pool lock-name timeout-ms wait-ms)
Attempts to acquire a distributed lock, returning an owner UUID iff successful.
Attempts to acquire a distributed lock, returning an owner UUID iff successful.
(_have-lock? pool lock-name owner-uuid)
(_release-lock pool lock-name owner-uuid)
Attempts to release a distributed lock, returning true iff successful.
Attempts to release a distributed lock, returning true iff successful.
(_wcar conn-pool & body)
(_wcar conn-pool :as-pipeline & body)
The ConnectionPool returned from conn-pool must be the first argument to this macro
Evaluates body in the context of a fresh thread-bound pooled connection to
Redis server. Sends Redis commands to server as pipeline and returns the
server's response. Releases connection back to pool when done.
conn-opts
arg is a map with connection pool and spec options:
{:pool {} :spec {:host "127.0.0.1" :port 6379}} ; Default
{:pool {} :spec {:uri "redis://redistogo:pass@panga.redistogo.com:9475/"}}
{:pool {} :spec {:host "127.0.0.1" :port 6379
:password "secret"
:timeout-ms 6000
:db 3}}
A nil
or {}
conn-opts
will use defaults. A :none
pool can be used
to skip connection pooling (not recommended).
For other pool options, Ref. http://goo.gl/e1p1h3,
http://goo.gl/Sz4uN1 (defaults).
Note that because of thread-binding, you'll probably want to avoid lazy Redis
command calls in wcar
's body unless you know what you're doing. Compare:
(wcar {} (for [k [:k1 :k2]] (car/set k :val))
; Lazy, NO commands run
(wcar {} (doseq [k [:k1 :k2]] (car/set k :val))
; Not lazy, commands run
See also with-replies
.
The ConnectionPool returned from conn-pool must be the first argument to this macro Evaluates body in the context of a fresh thread-bound pooled connection to Redis server. Sends Redis commands to server as pipeline and returns the server's response. Releases connection back to pool when done. `conn-opts` arg is a map with connection pool and spec options: {:pool {} :spec {:host "127.0.0.1" :port 6379}} ; Default {:pool {} :spec {:uri "redis://redistogo:pass@panga.redistogo.com:9475/"}} {:pool {} :spec {:host "127.0.0.1" :port 6379 :password "secret" :timeout-ms 6000 :db 3}} A `nil` or `{}` `conn-opts` will use defaults. A `:none` pool can be used to skip connection pooling (not recommended). For other pool options, Ref. http://goo.gl/e1p1h3, http://goo.gl/Sz4uN1 (defaults). Note that because of thread-binding, you'll probably want to avoid lazy Redis command calls in `wcar`'s body unless you know what you're doing. Compare: `(wcar {} (for [k [:k1 :k2]] (car/set k :val))` ; Lazy, NO commands run `(wcar {} (doseq [k [:k1 :k2]] (car/set k :val))` ; Not lazy, commands run See also `with-replies`.
(close-pool {:keys [pool]})
(conn-pool spec pool-opts)
(create spec opts)
Main public function that should be called to create a Redis pool instance
Main public function that should be called to create a Redis pool instance
(get-object-pool carmine-conn)
Internal helper function that returns the internal ObjectPool
Internal helper function that returns the internal ObjectPool
(lua _ script)
(nil-safe v default)
(pooled-conn {:keys [pool]})
(release-conn {:keys [pool]} conn)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close