An opensource memcached client for clojure,it wraps xmemcached.
0.2.3 releases, main highlights:
1.Supports delete with CAS value in binary protocol
;;delete with CAS
(xm/delete "num" (:cas (gets "num")))
2.Supports lighweight distribution lock with try-lock macro:
(def counter (atom 0))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
(swap! counter inc))
(println "else1")))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
(swap! counter inc))
(println "else2")))
(future (try-lock "lock" 5 (do (Thread/sleep 3000)
(swap! counter inc))
(println "else3")))
(Thread/sleep 4000)
(is (nil? (get "lock")))
(is (= 1 @counter))
3.Through macro:
(through uid (get-user-from-databse uid))
Equals to:
(if-let [rt (get uid)]
rt
(let [rt (get-user-from-database uid)]
(when rt
(add uid rt 0))
rt))
4.Upgrade xmemcached to 1.4.2
More tutorial please visit https://github.com/killme2008/clj-xmemcached
--
庄晓丹
Email: [email protected] [email protected]
Site: http://fnil.net
Twitter: @killme2008
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.