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

io.lettuce.core.ZPopArgs Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core;

import static io.lettuce.core.protocol.CommandKeyword.*;

import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.ProtocolKeyword;

/**
 * Argument list builder for the ZMPOP ZMPOP and
 * BZMPOP command starting. {@link ZPopArgs} is a mutable object and instances
 * should be used only once to avoid shared mutable state.
 *
 * @author Mark Paluch
 * @since 6.3
 */
public class ZPopArgs implements CompositeArgument {

    private ProtocolKeyword modifier;

    /**
     * Builder entry points for {@link ScanArgs}.
     */
    public static class Builder {

        /**
         * Utility constructor.
         */
        private Builder() {
        }

        /**
         * Creates new {@link ZPopArgs} and enabling {@literal MIN}.
         *
         * @return new {@link ZPopArgs} with {@literal MIN} enabled.
         * @see ZPopArgs#min()
         */
        public static ZPopArgs min() {
            return new ZPopArgs().min();
        }

        /**
         * Creates new {@link ZPopArgs} and enabling {@literal MAX}.
         *
         * @return new {@link ZPopArgs} with {@literal MAX} enabled.
         * @see ZPopArgs#min()
         */
        public static ZPopArgs max() {
            return new ZPopArgs().max();
        }

    }

    /**
     * Elements popped are those with the lowest scores from the first non-empty sorted set
     *
     * @return {@code this} {@link ZPopArgs}.
     */
    public ZPopArgs min() {

        this.modifier = MIN;
        return this;
    }

    /**
     * Elements popped are those with the highest scores from the first non-empty sorted set
     *
     * @return {@code this} {@link ZPopArgs}.
     */
    public ZPopArgs max() {

        this.modifier = MAX;
        return this;
    }

    @Override
    public  void build(CommandArgs args) {
        args.add(modifier);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy