Interface RedisTxCommands
- All Known Subinterfaces:
DefaultedRedisClusterConnection
,DefaultedRedisConnection
,RedisClusterConnection
,RedisCommands
,RedisConnection
,RedisConnectionUtils.RedisConnectionProxy
,StringRedisConnection
- All Known Implementing Classes:
AbstractRedisConnection
,DefaultStringRedisConnection
,JedisClusterConnection
,JedisConnection
,LettuceClusterConnection
,LettuceConnection
public interface RedisTxCommands
Transaction/Batch specific commands supported by Redis.
- Author:
- Costin Leau, Christoph Strobl, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
discard()
Discard all commands issued aftermulti()
.exec()
Executes all queued commands in a transaction started withmulti()
.void
multi()
Mark the start of a transaction block.void
unwatch()
Flushes all the previouslywatch(byte[]...)
keys.void
watch
(byte[]... keys) Watch givenkeys
for modifications during transaction started withmulti()
.
-
Method Details
-
multi
void multi()Mark the start of a transaction block.
Commands will be queued and can then be executed by callingexec()
or rolled back usingdiscard()
- See Also:
-
exec
Executes all queued commands in a transaction started withmulti()
.
If used along withwatch(byte[]...)
the operation will fail if any of watched keys has been modified.- Returns:
- List of replies for each executed command.
- See Also:
-
discard
void discard()Discard all commands issued aftermulti()
.- See Also:
-
watch
void watch(byte[]... keys) Watch givenkeys
for modifications during transaction started withmulti()
.- Parameters:
keys
- must not be null.- See Also:
-
unwatch
void unwatch()Flushes all the previouslywatch(byte[]...)
keys.- See Also:
-