Package io.lettuce.core
Class SetArgs
- java.lang.Object
-
- io.lettuce.core.SetArgs
-
- All Implemented Interfaces:
CompositeArgument
public class SetArgs extends Object implements CompositeArgument
Argument list builder for the Redis SET command starting from Redis 2.6.12. Static import the methods fromSetArgs.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.- Author:
- Will Glozer, Vincent Rischmann, Mark Paluch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SetArgs.Builder
Builder entry points forSetArgs
.
-
Constructor Summary
Constructors Constructor Description SetArgs()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
voidbuild(CommandArgs<K,V> args)
Build command arguments and contribute arguments toCommandArgs
.SetArgs
ex(long timeout)
Set the specified expire time, in seconds.SetArgs
ex(Duration timeout)
Set the specified expire time, in seconds.SetArgs
exAt(long timestamp)
Set the specified expire at time using a posixtimestamp
.SetArgs
exAt(Instant timestamp)
Set the specified expire at time using a posixtimestamp
.SetArgs
exAt(Date timestamp)
Set the specified expire at time using a posixtimestamp
.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
px(Duration timeout)
Set the specified expire time, in milliseconds.SetArgs
pxAt(long timestamp)
Set the specified expire at time using a posixtimestamp
.SetArgs
pxAt(Instant timestamp)
Set the specified expire at time using a posixtimestamp
.SetArgs
pxAt(Date timestamp)
Set the specified expire at time using a posixtimestamp
.SetArgs
xx()
Only set the key if it already exists.
-
-
-
Method Detail
-
ex
public SetArgs ex(long timeout)
Set the specified expire time, in seconds.- Parameters:
timeout
- expire time in seconds.- Returns:
this
SetArgs
.
-
ex
public SetArgs ex(Duration timeout)
Set the specified expire time, in seconds.- Parameters:
timeout
- expire time in seconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
exAt
public SetArgs exAt(long timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in seconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
exAt
public SetArgs exAt(Date timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in seconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
exAt
public SetArgs exAt(Instant timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in seconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
px
public SetArgs px(long timeout)
Set the specified expire time, in milliseconds.- Parameters:
timeout
- expire time in milliseconds.- Returns:
this
SetArgs
.
-
px
public SetArgs px(Duration timeout)
Set the specified expire time, in milliseconds.- Parameters:
timeout
- expire time in milliseconds.- Returns:
this
SetArgs
.
-
pxAt
public SetArgs pxAt(long timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in milliseconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
pxAt
public SetArgs pxAt(Date timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in milliseconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
pxAt
public SetArgs pxAt(Instant timestamp)
Set the specified expire at time using a posixtimestamp
.- Parameters:
timestamp
- the timestamp type: posix time in milliseconds.- Returns:
this
SetArgs
.- Since:
- 6.1
-
keepttl
public SetArgs keepttl()
Set the value and retain the existing TTL.- Returns:
this
SetArgs
.- Since:
- 5.3
-
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
.
-
-