org.infinispan.server.resp.commands.pubsub.PUBSUB Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-server-resp Show documentation
Show all versions of infinispan-server-resp Show documentation
Infinispan Resp Protocol Server
The newest version!
package org.infinispan.server.resp.commands.pubsub;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import org.infinispan.server.resp.RespCommand;
import org.infinispan.server.resp.commands.FamilyCommand;
/**
* Family of `PUBSUB
` commands.
*
* @since 15.0
* @link Redis documentation
*/
public class PUBSUB extends FamilyCommand {
private static final RespCommand[] PUBSUB_COMMANDS;
static {
PUBSUB_COMMANDS = new RespCommand[] {
new CHANNELS(),
new NUMPAT(),
};
}
public PUBSUB() {
super(-2, 0, 0, 0);
}
@Override
public RespCommand[] getFamilyCommands() {
return PUBSUB_COMMANDS;
}
static Predicate deduplicate() {
List channels = new ArrayList<>(4);
return channel -> {
for (byte[] bytes : channels) {
if (Arrays.equals(channel, bytes))
return false;
}
channels.add(channel);
return true;
};
}
}