diff --git a/spec/redis_spec.cr b/spec/redis_spec.cr index e8b4b13..7549550 100644 --- a/spec/redis_spec.cr +++ b/spec/redis_spec.cr @@ -199,6 +199,11 @@ describe Redis::Client do redis.zcount(key, "0", "+inf").should eq(3) redis.zcount(key, "(1", "3").should eq(2) end + + test "returns the score of a member in a sorted set at key" do + redis.zadd(key, "1", "one") + redis.zscore(key, "one").should eq("1") + end end describe "hash" do diff --git a/src/commands/sorted_set.cr b/src/commands/sorted_set.cr index 5358c32..35ccff9 100644 --- a/src/commands/sorted_set.cr +++ b/src/commands/sorted_set.cr @@ -58,4 +58,8 @@ module Redis::Commands::SortedSet def zcount(key : String, min : String, max : String) run({"zcount", key, min, max}) end + + def zscore(key : String, value : String) + run({"zscore", key, value}) + end end