public class SetArgs extends Object implements CompositeArgument
SetArgs.Builder
and chain the method calls: ex(10).nx()
.
SetArgs
is a mutable object and instances should be used only once to avoid shared mutable state.
Modifier and Type | Class and Description |
---|---|
static class |
SetArgs.Builder
Builder entry points for
SetArgs . |
Constructor and Description |
---|
SetArgs() |
Modifier and Type | Method and Description |
---|---|
<K,V> void |
build(CommandArgs<K,V> args)
Build command arguments and contribute arguments to
CommandArgs . |
SetArgs |
ex(Duration timeout)
Set the specified expire time, in seconds.
|
SetArgs |
ex(long timeout)
Set the specified expire time, in seconds.
|
SetArgs |
exAt(Date timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
exAt(Instant timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
exAt(long timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
keepttl()
Set the value and retain the existing TTL.
|
SetArgs |
nx()
Only set the key if it does not already exist.
|
SetArgs |
px(Duration timeout)
Set the specified expire time, in milliseconds.
|
SetArgs |
px(long timeout)
Set the specified expire time, in milliseconds.
|
SetArgs |
pxAt(Date timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
pxAt(Instant timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
pxAt(long timestamp)
Set the specified expire at time using a posix
timestamp . |
SetArgs |
xx()
Only set the key if it already exists.
|
public SetArgs ex(long timeout)
timeout
- expire time in seconds.this
SetArgs
.public SetArgs ex(Duration timeout)
timeout
- expire time in seconds.this
SetArgs
.public SetArgs exAt(long timestamp)
timestamp
.timestamp
- the timestamp type: posix time in seconds.this
SetArgs
.public SetArgs exAt(Date timestamp)
timestamp
.timestamp
- the timestamp type: posix time in seconds.this
SetArgs
.public SetArgs exAt(Instant timestamp)
timestamp
.timestamp
- the timestamp type: posix time in seconds.this
SetArgs
.public SetArgs px(long timeout)
timeout
- expire time in milliseconds.this
SetArgs
.public SetArgs px(Duration timeout)
timeout
- expire time in milliseconds.this
SetArgs
.public SetArgs pxAt(long timestamp)
timestamp
.timestamp
- the timestamp type: posix time in milliseconds.this
SetArgs
.public SetArgs pxAt(Date timestamp)
timestamp
.timestamp
- the timestamp type: posix time in milliseconds.this
SetArgs
.public SetArgs pxAt(Instant timestamp)
timestamp
.timestamp
- the timestamp type: posix time in milliseconds.this
SetArgs
.public SetArgs keepttl()
this
SetArgs
.public <K,V> void build(CommandArgs<K,V> args)
CompositeArgument
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.
build
in interface CompositeArgument
K
- Key type.V
- Value type.args
- the command arguments, must not be null
.Copyright © 2025 lettuce.io. All rights reserved.