Module lettuce.core

Class SortArgs

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

public class SortArgs
extends Object
implements CompositeArgument
Argument list builder for the Redis SORT command. Static import the methods from SortArgs.Builder and chain the method calls: by("weight_*").desc().limit(0, 2).

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

Author:
Will Glozer, Mark Paluch
  • Constructor Details

    • SortArgs

      public SortArgs()
  • Method Details

    • by

      public SortArgs by​(String pattern)
      Sort keys by an external list. Key names are obtained substituting the first occurrence of * with the actual value of the element in the list.
      Parameters:
      pattern - key name pattern.
      Returns:
      this SortArgs.
    • limit

      public SortArgs limit​(long offset, long count)
      Limit the number of returned elements.
      Parameters:
      offset -
      count -
      Returns:
      this SortArgs.
    • limit

      public SortArgs limit​(Limit limit)
      Limit the number of returned elements.
      Parameters:
      limit - must not be null.
      Returns:
      this SortArgs.
    • get

      public SortArgs get​(String pattern)
      Retrieve external keys during sort. GET supports # and * wildcards.
      Parameters:
      pattern - must not be null.
      Returns:
      this SortArgs.
    • asc

      public SortArgs asc()
      Apply numeric sort in ascending order.
      Returns:
      this SortArgs.
    • desc

      public SortArgs desc()
      Apply numeric sort in descending order.
      Returns:
      this SortArgs.
    • alpha

      public SortArgs alpha()
      Apply lexicographically sort.
      Returns:
      this SortArgs.
    • 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.