@Experimental public class ArGrepArgs extends Object implements CompositeArgument
ARGREP command.
Bundles the range (start/end), one or more predicates, optional AND/OR combiner, LIMIT, and NOCASE flags.
A null lower bound maps to the Redis - token and a null upper bound maps to +.
Example usage:
ArGrepArgs.unbounded().exact("hello");
ArGrepArgs.range(0, 100).match("world").nocase();
ArGrepArgs.from(5).glob("prefix*");
ArGrepArgs.to(100).re("^foo.*");
ArGrepArgs.unbounded().re("^foo.*").glob("bar*").and().limit(10);
ArGrepArgs.unbounded().reversed().exact("hello"); // all elements, descending
ArGrepArgs.range(3, 7).reversed().exact("foo"); // elements in [3,7], descending
ArGrepArgs is a mutable object and instances should be used only once to avoid shared mutable state.| Modifier and Type | Method and Description |
|---|---|
ArGrepArgs |
and()
Sets the predicate combiner to AND (default is OR).
|
<K,V> void |
build(CommandArgs<K,V> args)
Build command arguments and contribute arguments to
CommandArgs. |
ArGrepArgs |
exact(String value)
Adds an EXACT predicate.
|
static ArGrepArgs |
from(long start)
Creates a new
ArGrepArgs with a lower bound only (start + in Redis). |
ArGrepArgs |
glob(String pattern)
Adds a GLOB predicate.
|
ArGrepArgs |
limit(long limit)
Sets the maximum number of results to return.
|
ArGrepArgs |
match(String value)
Adds a MATCH (substring) predicate.
|
ArGrepArgs |
nocase()
Enables case-insensitive matching.
|
static ArGrepArgs |
range(long start,
long end)
Creates a new
ArGrepArgs with a bounded range. |
ArGrepArgs |
re(String pattern)
Adds a RE (regex) predicate.
|
ArGrepArgs |
reversed()
Reverses the iteration order.
|
static ArGrepArgs |
to(long end)
Creates a new
ArGrepArgs with an upper bound only (- end in Redis). |
static ArGrepArgs |
unbounded()
Creates a new
ArGrepArgs with an unbounded range (- + in Redis). |
public static ArGrepArgs unbounded()
ArGrepArgs with an unbounded range (- + in Redis).ArGrepArgs instance.public static ArGrepArgs range(long start, long end)
ArGrepArgs with a bounded range.start - the start index (inclusive).end - the end index (inclusive).ArGrepArgs instance.public static ArGrepArgs from(long start)
ArGrepArgs with a lower bound only (start + in Redis).start - the start index (inclusive); upper bound is unbounded.ArGrepArgs instance.public static ArGrepArgs to(long end)
ArGrepArgs with an upper bound only (- end in Redis).end - the end index (inclusive); lower bound is unbounded.ArGrepArgs instance.public ArGrepArgs exact(String value)
value - the exact value to match.this.public ArGrepArgs match(String value)
value - the substring to match.this.public ArGrepArgs glob(String pattern)
pattern - the glob pattern.this.public ArGrepArgs re(String pattern)
pattern - the regex pattern.this.public ArGrepArgs and()
this.public ArGrepArgs limit(long limit)
limit - the limit.this.public ArGrepArgs nocase()
this.public ArGrepArgs reversed()
On the wire, this swaps the two range arguments (e.g. 3 7 becomes 7 3).
this.public <K,V> void build(CommandArgs<K,V> args)
CompositeArgumentCommandArgs.
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.
build in interface CompositeArgumentK - Key type.V - Value type.args - the command arguments, must not be null.Copyright © 2026 lettuce.io. All rights reserved.