Closed barkanido closed 8 years ago
Hi Ido,
but what bothers me is the intermediate return values by car/get
Individual Redis command calls (like car/get
) always return nil
. A call to car/get
just queues a Redis command for later execution; the command's reply from Redis is visible only in the return value of the enclosing wcar
call.
wcar
opens a connection to Redis, executes all enclosed commands in a pipeline, returns all the replies, then releases the connection to Redis.
Does that make sense?
making sure that only a single round trip to redis
That's correct. A single wcar
usually implies a single round trip to Redis (there may be exceptions in a few unusual cases for commands that require an immediate response).
insert a gzip call to unzip each value (if it was found).
You can do this either with Carmine's reply parsing feature, or just with Clojure's destructuring:
(let [[-resp1 -resp2] (wcar* (car/get "foo") (car/get "bar"))
resp1 (unzip -resp1)
resp2 (unzip -resp2)]
...
)
Does that help? Please feel free to close if you're satisfied, cheers :-)
that's perfect. thanks!
Hi, I am trying to pipeline a series of
car/get
calls and I get unexpected responses(require '[taoensso.timbre :refer [spy]])
(require '[taoensso.carmine :as car])
(def tranid "71wwN8nQJEdEpTHPGrj7sA")
(wcar* (:clent db) :as-pipeline (doseq [k [tranid "not-there"]] (spy (car/get k))))
now the return value is correct: the first key is there and the second is not, but what bothers me is the intermediate return values by
car/get
. specifically I am interested incan you explain the logging?