@Experimental public class HotkeysArgs extends Object implements CompositeArgument
HotkeysArgs.Builder and chain the method calls: metrics(Metric.CPU, Metric.NET).count(20).
HotkeysArgs is a mutable object and instances should be used only once to avoid shared mutable state.
| Modifier and Type | Class and Description |
|---|---|
static class |
HotkeysArgs.Builder
Builder entry points for
HotkeysArgs. |
static class |
HotkeysArgs.Metric
Metrics to track for hotkeys.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
COUNT_MAX
Maximum value for COUNT option.
|
static int |
COUNT_MIN
Minimum value for COUNT option.
|
static long |
DURATION_MIN
Minimum value for DURATION option (seconds). 0 means no auto-stop.
|
static int |
SAMPLE_MIN
Minimum value for SAMPLE option.
|
static int |
SLOT_MAX
Maximum slot number (inclusive).
|
static int |
SLOT_MIN
Minimum slot number (inclusive).
|
static int |
SLOTS_MAX_COUNT
Maximum number of slots that can be specified.
|
| Constructor and Description |
|---|
HotkeysArgs() |
| Modifier and Type | Method and Description |
|---|---|
<K,V> void |
build(CommandArgs<K,V> args)
Build command arguments and contribute arguments to
CommandArgs. |
HotkeysArgs |
count(int count)
Set the number of top keys to report.
|
HotkeysArgs |
duration(Duration duration)
Set the auto-stop duration.
|
HotkeysArgs |
duration(long duration)
Set the auto-stop duration in seconds.
|
HotkeysArgs |
metrics(HotkeysArgs.Metric... metrics)
Set the metrics to track.
|
HotkeysArgs |
sample(int ratio)
Set the sampling ratio.
|
HotkeysArgs |
slots(int... slots)
Set the slot numbers to track (cluster mode only).
|
public static final int COUNT_MIN
public static final int COUNT_MAX
public static final long DURATION_MIN
public static final int SAMPLE_MIN
public static final int SLOT_MIN
public static final int SLOT_MAX
public static final int SLOTS_MAX_COUNT
public HotkeysArgs metrics(HotkeysArgs.Metric... metrics)
metrics - the metrics to track (CPU and/or NET).this HotkeysArgs.public HotkeysArgs count(int count)
count - number of keys (min: 10, max: 64).this HotkeysArgs.public HotkeysArgs duration(long duration)
duration - duration in seconds (min: 0L, 0 = no auto-stop).this HotkeysArgs.public HotkeysArgs duration(Duration duration)
duration - duration (min: 0Ls).this HotkeysArgs.public HotkeysArgs sample(int ratio)
ratio - sampling ratio (min: 1, 1 = track every key, higher values = sample less frequently).this HotkeysArgs.public HotkeysArgs slots(int... slots)
In the response, Redis groups consecutive slots into ranges. For example, if you specify slots 0, 1, 2, and 100, the
response's HotkeysReply.getSelectedSlots() will contain two entries: a range [0, 2] for the consecutive
slots and [100, 100] for the single slot.
slots - the slot numbers.this HotkeysArgs.HotkeysReply.getSelectedSlots()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.