Class ZRANDMEMBER
java.lang.Object
org.infinispan.server.resp.RespCommand
org.infinispan.server.resp.commands.sortedset.ZRANDMEMBER
- All Implemented Interfaces:
Resp3Command
When called with just the key argument, return a random element from the sorted set value stored at key.
If the provided count argument is positive, return an array of distinct elements.
The array's length is either count or the sorted set's cardinality (
ZCARD), whichever is lower.
If called with a negative count, the behavior changes and the command is allowed to return the same element
multiple times. In this case, the number of returned elements is the absolute value of the specified count.
The optional WITHSCORES modifier changes the reply, so it includes the respective scores of the randomly
selected elements from the sorted set.
- Bulk string reply: without the additional count argument, the command returns a Bulk Reply with the randomly selected element, or nil when key does not exist.
- Array reply: when the additional count argument is passed, the command returns an array of elements, or an empty array when key does not exist.
- Since:
- 15.0
- See Also:
-
Field Summary
Fields inherited from class org.infinispan.server.resp.RespCommand
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionperform(Resp3Handler handler, io.netty.channel.ChannelHandlerContext ctx, List<byte[]> arguments) Methods inherited from class org.infinispan.server.resp.RespCommand
extractKeys, fromByteBuf, getArity, getFirstKeyPos, getLastKeyPos, getName, getSteps, handleException, hasValidNumberOfArguments, match, size, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.server.resp.commands.Resp3Command
handleException
-
Constructor Details
-
ZRANDMEMBER
public ZRANDMEMBER()
-
-
Method Details
-
perform
public CompletionStage<RespRequestHandler> perform(Resp3Handler handler, io.netty.channel.ChannelHandlerContext ctx, List<byte[]> arguments) - Specified by:
performin interfaceResp3Command
-