Module lettuce.core

Class KeyScanArgs

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

public class KeyScanArgs
extends ScanArgs
Argument list builder for the Redis SCAN command. Static import the methods from KeyScanArgs.Builder and chain the method calls: type("string").limit(2).

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

Since:
6.1
Author:
Mykola Makhin
  • Constructor Details

    • KeyScanArgs

      public KeyScanArgs()
  • Method Details

    • type

      public KeyScanArgs type​(String type)
      Return keys only of specified type.
      Parameters:
      type - of keys as returned by TYPE command
      Returns:
      this KeyScanArgs.
    • match

      public KeyScanArgs match​(String match)
      Set the match filter. Uses UTF-8 to encode match.
      Overrides:
      match in class ScanArgs
      Parameters:
      match - the filter, must not be null.
      Returns:
      this ScanArgs.
    • match

      public KeyScanArgs match​(String match, Charset charset)
      Set the match filter along the given Charset.
      Overrides:
      match in class ScanArgs
      Parameters:
      match - the filter, must not be null.
      charset - the charset for match, must not be null.
      Returns:
      this ScanArgs.
    • limit

      public KeyScanArgs limit​(long count)
      Limit the scan by count
      Overrides:
      limit in class ScanArgs
      Parameters:
      count - number of elements to scan
      Returns:
      this ScanArgs.
    • 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
      Overrides:
      build in class ScanArgs
      Type Parameters:
      K - Key type.
      V - Value type.
      Parameters:
      args - the command arguments, must not be null.