Permalink
Browse files

some zset commands

  • Loading branch information...
1 parent eb49903 commit bc97d612d7509b44b2347feec3324f9a222afd5f @mmcgrana mmcgrana committed Jan 3, 2011
Showing with 19 additions and 0 deletions.
  1. +4 −0 readme.md
  2. +15 −0 src/clj_redis/client.clj
View
@@ -34,6 +34,10 @@ Implemented commands:
* blpop
* rpop
* brpop
+* zadd
+* zcard
+* zrangebyscore
+* zrem
## Installation
View
@@ -63,3 +63,18 @@
(defn brpop [p ks ^Integer t]
(if-let [pair (lease p (fn [^Jedis j] (.brpop j t ^"[Ljava.lang.String;" (into-array ks))))]
(seq pair)))
+
+(defn zadd [p ^String k ^Double r ^String m]
+ (lease p (fn [^Jedis j] (.zadd j k r m))))
+
+(defn zcard [p ^String k]
+ (lease p (fn [^Jedis j] (.zcard j k))))
+
+(defn zrangebyscore
+ ([p ^String k ^Double min ^Double max]
+ (seq (lease p (fn [^Jedis j] (.zrangeByScore j k min max)))))
+ ([p ^String k ^Double min ^Double max ^Integer offset ^Integer count]
+ (seq (lease p (fn [^Jedis j] (.zrangeByScore j k min max offset count))))))
+
+(defn zrem [p ^String k ^String m]
+ (lease p (fn [^Jedis j] (.zrem j k m))))

0 comments on commit bc97d61

Please sign in to comment.