All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.server.resp.commands.pubsub.PUBSUB Maven / Gradle / Ivy

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;
      };
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy