Module lettuce.core

Class GeoArgs

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

public class GeoArgs
extends Object
implements CompositeArgument
Argument list builder for the Redis GEORADIUS and GEORADIUSBYMEMBER commands.

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

Author:
Mark Paluch
  • Constructor Details

    • GeoArgs

      public GeoArgs()
  • Method Details

    • withDistance

      public GeoArgs withDistance()
      Request distance for results.
      Returns:
      this GeoArgs.
    • withCoordinates

      public GeoArgs withCoordinates()
      Request coordinates for results.
      Returns:
      this GeoArgs.
    • withHash

      public GeoArgs withHash()
      Request geohash for results.
      Returns:
      this GeoArgs.
    • withCount

      public GeoArgs withCount​(long count)
      Limit results to count entries.
      Parameters:
      count - number greater 0.
      Returns:
      this GeoArgs.
    • withCount

      public GeoArgs withCount​(long count, boolean any)
      Limit results to count entries.
      Parameters:
      count - number greater 0.
      any - whether to complete the command as soon as enough matches are found, so the results may not be the ones closest to the specified point.
      Returns:
      this GeoArgs.
      Since:
      6.1
    • isWithDistance

      public boolean isWithDistance()
      Returns:
      true if distance is requested.
    • isWithCoordinates

      public boolean isWithCoordinates()
      Returns:
      true if coordinates are requested.
    • isWithHash

      public boolean isWithHash()
      Returns:
      true if geohash is requested.
    • asc

      public GeoArgs asc()
      Sort results ascending.
      Returns:
      this
    • desc

      public GeoArgs desc()
      Sort results descending.
      Returns:
      this
    • sort

      public GeoArgs sort​(GeoArgs.Sort sort)
      Sort results.
      Parameters:
      sort - sort order, must not be null
      Returns:
      this
    • 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.