Package io.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 fromSortArgs.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SortArgs.Builder
Builder entry points forSortArgs
.
-
Constructor Summary
Constructors Constructor Description SortArgs()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortArgs
alpha()
Apply lexicographically sort.SortArgs
asc()
Apply numeric sort in ascending order.<K,V>
voidbuild(CommandArgs<K,V> args)
Build command arguments and contribute arguments toCommandArgs
.SortArgs
by(String pattern)
Sort keys by an external list.SortArgs
desc()
Apply numeric sort in descending order.SortArgs
get(String pattern)
Retrieve external keys during sort.SortArgs
limit(long offset, long count)
Limit the number of returned elements.SortArgs
limit(Limit limit)
Limit the number of returned elements.
-
-
-
Method Detail
-
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 benull
.- Returns:
this
SortArgs
.
-
get
public SortArgs get(String pattern)
Retrieve external keys during sort. GET supports#
and*
wildcards.- Parameters:
pattern
- must not benull
.- Returns:
this
SortArgs
.
-
build
public <K,V> void build(CommandArgs<K,V> args)
Description copied from interface:CompositeArgument
Build command arguments and contribute arguments toCommandArgs
.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 interfaceCompositeArgument
- Type Parameters:
K
- Key type.V
- Value type.- Parameters:
args
- the command arguments, must not benull
.
-
-