Method: Redis::Commands::SortedSets#zrandmember
- Defined in:
- lib/redis/commands/sorted_sets.rb
#zrandmember(key, count = nil, withscores: false, with_scores: withscores) ⇒ nil, ...
Get one or more random members from a sorted set.
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/redis/commands/sorted_sets.rb', line 262 def zrandmember(key, count = nil, withscores: false, with_scores: withscores) if with_scores && count.nil? raise ArgumentError, "count argument must be specified" end args = [:zrandmember, key] args << Integer(count) if count if with_scores args << "WITHSCORES" block = FloatifyPairs end send_command(args, &block) end |