Class ScanArgs

  • All Implemented Interfaces:
    CompositeArgument
    Direct Known Subclasses:
    KeyScanArgs

    public class ScanArgs
    extends Object
    implements CompositeArgument
    Argument list builder for the Redis scan commands (SCAN, HSCAN, SSCAN, ZSCAN). Static import the methods from ScanArgs.Builder and chain the method calls: matches("weight_*").limit(2).

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

    Since:
    3.0
    Author:
    Mark Paluch, Ge Jun
    • Constructor Detail

      • ScanArgs

        public ScanArgs()
    • Method Detail

      • match

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

        public ScanArgs match​(String match,
                              Charset charset)
        Set the match filter along the given Charset.
        Parameters:
        match - the filter, must not be null.
        charset - the charset for match, must not be null.
        Returns:
        this ScanArgs.
        Since:
        6.0
      • match

        public ScanArgs match​(byte[] match)
        Set the match filter.
        Parameters:
        match - the filter, must not be null.
        Returns:
        this ScanArgs.
        Since:
        6.0.4
      • limit

        public ScanArgs limit​(long count)
        Limit the scan by count
        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
        Type Parameters:
        K - Key type.
        V - Value type.
        Parameters:
        args - the command arguments, must not be null.