You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/asciidoc/reference/redis-transactions.adoc
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
[[tx]]
2
2
= Redis Transactions
3
3
4
-
Redis provides support for https://redis.io/topics/transactions[transactions] through the `multi`, `exec`, and `discard` commands.These operations are available on `RedisTemplate`.However, `RedisTemplate` is not guaranteed to run all the operations in the transaction with the same connection.
4
+
Redis provides support for https://redis.io/topics/transactions[transactions] through the `multi`, `exec`, and `discard` commands.
5
+
These operations are available on `RedisTemplate`.
6
+
However, `RedisTemplate` is not guaranteed to run all the operations in the transaction with the same connection.
5
7
6
8
Spring Data Redis provides the `SessionCallback` interface for use when multiple operations need to be performed with the same `connection`, such as when using Redis transactions.The following example uses the `multi` method:
System.out.println("Number of items added to set: " + txResults.get(0));
21
23
----
22
24
23
-
`RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results of `exec` before returning.There is an additional `exec` method that lets you pass a custom serializer for transaction results.
25
+
`RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results of `exec` before returning.
26
+
There is an additional `exec` method that lets you pass a custom serializer for transaction results.
24
27
25
28
include::version-note.adoc[]
26
29
@@ -74,7 +77,9 @@ public class RedisTxContextConfiguration {
74
77
----
75
78
<1> Configures a Spring Context to enable https://docs.spring.io/spring/docs/{springVersion}/spring-framework-reference/data-access.html#transaction-declarative[declarative transaction management].
76
79
<2> Configures `RedisTemplate` to participate in transactions by binding connections to the current thread.
77
-
<3> Transaction management requires a `PlatformTransactionManager`.Spring Data Redis does not ship with a `PlatformTransactionManager` implementation.Assuming your application uses JDBC, Spring Data Redis can participate in transactions by using existing transaction managers.
80
+
<3> Transaction management requires a `PlatformTransactionManager`.
81
+
Spring Data Redis does not ship with a `PlatformTransactionManager` implementation.
82
+
Assuming your application uses JDBC, Spring Data Redis can participate in transactions by using existing transaction managers.
78
83
====
79
84
80
85
The following examples each demonstrate a usage constraint:
0 commit comments