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(long timeout)
Set the specified expire time, in seconds.
|
SetArgs |
keepttl()
Set the value and retain the existing TTL.
|
SetArgs |
nx()
Only set the key if it does not already exist.
|
SetArgs |
px(long timeout)
Set the specified expire time, in milliseconds.
|
SetArgs |
xx()
Only set the key if it already exists.
|
public SetArgs ex(long timeout)
timeout
- expire time in seconds.this
SetArgs
.public SetArgs px(long timeout)
timeout
- expire 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 © 2021 lettuce.io. All rights reserved.