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

org.infinispan.server.resp.commands.hash.HEXISTS Maven / Gradle / Ivy

There is a newer version: 15.1.4.Final
Show newest version
package org.infinispan.server.resp.commands.hash;

import java.util.List;
import java.util.concurrent.CompletionStage;
import java.util.function.Function;

import org.infinispan.multimap.impl.EmbeddedMultimapPairCache;
import org.infinispan.server.resp.Resp3Handler;
import org.infinispan.server.resp.RespCommand;
import org.infinispan.server.resp.RespRequestHandler;
import org.infinispan.server.resp.commands.Resp3Command;
import org.infinispan.server.resp.serialization.Resp3Response;

import io.netty.channel.ChannelHandlerContext;

/**
 * `HEXISTS key field` command.
 * 

* Verify if the specified field exists in the hash stored at key. Returns 1 if true, * or 0, otherwise. *

* * @since 15.0 * @see Redis Documentation * @author José Bolina */ public class HEXISTS extends RespCommand implements Resp3Command { static final Function CONVERTER = b -> b ? 1L : 0L; public HEXISTS() { super(3, 1, 1, 1); } @Override public CompletionStage perform(Resp3Handler handler, ChannelHandlerContext ctx, List arguments) { EmbeddedMultimapPairCache multimap = handler.getHashMapMultimap(); CompletionStage cs = multimap.contains(arguments.get(0), arguments.get(1)).thenApply(CONVERTER); return handler.stageToReturn(cs, ctx, Resp3Response.INTEGER); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy