Skip to content

Commit

Permalink
Add ZCARD
Browse files Browse the repository at this point in the history
  • Loading branch information
ragnard committed Mar 15, 2010
1 parent 524c249 commit f3ab136
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/redis.clj
Expand Up @@ -113,6 +113,7 @@
(zrem [key member] :bulk int-to-bool)
(zincrby [key increment member] :bulk string-to-double)
(zscore [key member] :bulk string-to-double)
(zcard [key] :inline)
(zrange [key start end] :inline)
(zrevrange [key start end] :inline)
(zrangebyscore [key start end] :inline)
Expand Down
5 changes: 5 additions & 0 deletions test/redis/tests.clj
Expand Up @@ -404,6 +404,11 @@
(is (= ["two"] (redis/zrangebyscore "zset" 1.1 2.9)))
(is (= ["two" "three"] (redis/zrangebyscore "zset" 1.0000001 3.00001))))

(deftest zcard
(is (thrown? Exception (redis/zcard "foo")))
(is (= 0 (redis/zcard "zset")))
(redis/zadd "zset" 1.0 "one")
(is (= 1 (redis/zcard "zset"))))


;;
Expand Down

0 comments on commit f3ab136

Please sign in to comment.