Module lettuce.core

Class ZAddArgs

java.lang.Object
io.lettuce.core.ZAddArgs
All Implemented Interfaces:
CompositeArgument

public class ZAddArgs
extends Object
implements CompositeArgument
Argument list builder for the improved Redis ZADD command starting from Redis 3.0.2. Static import the methods from ZAddArgs.Builder and call the methods: xx() or nx() .

ZAddArgs is a mutable object and instances should be used only once to avoid shared mutable state.

Author:
Mark Paluch, dengliming
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  ZAddArgs.Builder
    Builder entry points for ScanArgs.
  • Constructor Summary

    Constructors
    Constructor Description
    ZAddArgs()  
  • Method Summary

    Modifier and Type Method Description
    <K,​ V> void build​(CommandArgs<K,​V> args)
    Build command arguments and contribute arguments to CommandArgs.
    ZAddArgs ch()
    Modify the return value from the number of new elements added, to the total number of elements changed.
    ZAddArgs gt()
    Only update existing elements if the new score is greater than the current score.
    ZAddArgs lt()
    Only update existing elements if the new score is less than the current score.
    ZAddArgs nx()
    Don't update already existing elements.
    ZAddArgs xx()
    Only update elements that already exist.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ZAddArgs

      public ZAddArgs()
  • Method Details

    • nx

      public ZAddArgs nx()
      Don't update already existing elements. Always add new elements.
      Returns:
      this ZAddArgs.
    • xx

      public ZAddArgs xx()
      Only update elements that already exist. Never add elements.
      Returns:
      this ZAddArgs.
    • ch

      public ZAddArgs ch()
      Modify the return value from the number of new elements added, to the total number of elements changed.
      Returns:
      this ZAddArgs.
    • gt

      public ZAddArgs gt()
      Only update existing elements if the new score is greater than the current score. This flag doesn't prevent adding new elements.
      Returns:
      this ZAddArgs.
      Since:
      6.1
    • lt

      public ZAddArgs lt()
      Only update existing elements if the new score is less than the current score. This flag doesn't prevent adding new elements.
      Returns:
      this ZAddArgs.
      Since:
      6.1
    • build

      public <K,​ V> void build​(CommandArgs<K,​V> args)
      Description copied from interface: CompositeArgument
      Build command arguments and contribute arguments to CommandArgs.

      Implementing classes are required to implement this method. Depending on the command nature and configured arguments, this method may contribute arguments but is not required to add arguments if none are specified.

      Specified by:
      build in interface CompositeArgument
      Type Parameters:
      K - Key type.
      V - Value type.
      Parameters:
      args - the command arguments, must not be null.