Skip to content
ragnard edited this page Sep 13, 2010 · 8 revisions

Support for pipelining was introduced in redis-clojure 1.2.

The pipeline macro executes any Redis commands in the body in pipelined manner. Commands in the body will return nil, and the result of a pipeline form will be a vector of replies to any commands in body, in the corresponding order.

Example:

(redis/pipeline
  (redis/get "key1")
  (redis/set "key2" "value1")
  (redis/set "key3" "value2"))

Will return:

[nil "OK" "OK"]

Exceptions

Any exceptions thrown as a result of executing a Redis command in the body of a pipeline will be caught and returned in the reply vector.

Example:

(redis/pipeline
  (redis/set "counter" "blahonga")
  (redis/incr "counter"))

Will return

["OK" #<Exception java.lang.Exception: ERR value is not an integer>]
Clone this wiki locally