lib/redis/commands/bitmaps.rb in redis-5.0.8 vs lib/redis/commands/bitmaps.rb in redis-5.1.0

- old
+ new

@@ -25,13 +25,17 @@ # Count the number of set bits in a range of the string value stored at key. # # @param [String] key # @param [Integer] start start index # @param [Integer] stop stop index + # @param [String, Symbol] scale the scale of the offset range + # e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits # @return [Integer] the number of bits set to 1 - def bitcount(key, start = 0, stop = -1) - send_command([:bitcount, key, start, stop]) + def bitcount(key, start = 0, stop = -1, scale: nil) + command = [:bitcount, key, start, stop] + command << scale if scale + send_command(command) end # Perform a bitwise operation between strings and store the resulting string in a key. # # @param [String] operation e.g. `and`, `or`, `xor`, `not` @@ -49,17 +53,20 @@ # # @param [String] key # @param [Integer] bit whether to look for the first 1 or 0 bit # @param [Integer] start start index # @param [Integer] stop stop index + # @param [String, Symbol] scale the scale of the offset range + # e.g. 'BYTE' - interpreted as a range of bytes, 'BIT' - interpreted as a range of bits # @return [Integer] the position of the first 1/0 bit. # -1 if looking for 1 and it is not found or start and stop are given. - def bitpos(key, bit, start = nil, stop = nil) + def bitpos(key, bit, start = nil, stop = nil, scale: nil) raise(ArgumentError, 'stop parameter specified without start parameter') if stop && !start command = [:bitpos, key, bit] command << start if start command << stop if stop + command << scale if scale send_command(command) end end end end