a problem about Redis client: com.taoensso/carmine

354 views
Skip to first unread message

tao

unread,
Feb 8, 2014, 11:34:44 AM2/8/14
to clo...@googlegroups.com
lein try com.taoensso/carmine ;; try is from https://github.com/rkneufeld/lein-try 


(def server-connection {:pool {:max-active 8}
                               :spec {:host "localhost"
                                      :port 6379
                                      :timeout 4000}})

(require '[taoensso.carmine :as car :refer (wcar)])

(defmacro wcar* [& body] `(car/wcar server-connection ~@body))

(wcar* (car/hmset* "yyy" {:yyy "yyy", :pass "yyyyyy"}))

(wcar* (car/hgetall "yyy”))
["pass" "yyyyyy" "yyy" "yyy”]

(wcar* (car/hgetall* "yyy”))   
{"pass" "yyyyyy", "yyy" "yyy”}


But what I want (or expect) is what I set before:
{:yyy "yyy", :pass "yyyyyy"}

Who can help me? Thank you very much! 

tao

unread,
Feb 8, 2014, 11:50:17 AM2/8/14
to clo...@googlegroups.com
Repost: fix some quotation mark problem in the code.

-- 
tao
Sent with Sparrow

mynomoto

unread,
Feb 8, 2014, 12:06:30 PM2/8/14
to clo...@googlegroups.com
You can use:

(into {} (map (fn [[k v]] [(keyword k) v]) {"pass" "yyyyyy", "yyy" "yyy"}))

tao

unread,
Feb 8, 2014, 8:34:32 PM2/8/14
to clo...@googlegroups.com
Thank you very much!

-- 
tao
Sent with Sparrow

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

tao

unread,
Feb 8, 2014, 8:41:34 PM2/8/14
to clo...@googlegroups.com
after use your solution, I looked up the source code of carmine and found that:

(wcar* (car/hgetall* "yyy" true))

can get what I want.

Thank you!

-- 
tao
Sent with Sparrow

Reply all
Reply to author
Forward
0 new messages