From cc05b7e7348a66076bcc4790d46130b92c3da03f Mon Sep 17 00:00:00 2001 From: Jamie Gaskins Date: Thu, 16 Nov 2023 13:23:34 -0600 Subject: [PATCH] Allow ZREM to remove multiple values --- src/commands/sorted_set.cr | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/commands/sorted_set.cr b/src/commands/sorted_set.cr index a0c0eb3..b7d104a 100644 --- a/src/commands/sorted_set.cr +++ b/src/commands/sorted_set.cr @@ -55,6 +55,18 @@ module Redis::Commands::SortedSet run({"zrem", key, value}) end + def zrem(key : String, *values : String) + run({"zrem", key} + values) + end + + def zrem(key : String, values : Enumerable(String)) + command = Array(String).new(initial_capacity: 2 + values.size) + command << "zrem" << key + values.each { |value| command << value.as(String) } + + run command + end + def zcount(key : String, min : String, max : String) run({"zcount", key, min, max}) end