Skip to content

Commit be22fc6

Browse files
DATAREDIS-891 - Update documentation.
Update since tags, add issue reference and fix new line issues in reference documentation. Original Pull Request: #573
1 parent c4cba7f commit be22fc6

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/main/asciidoc/reference/redis-transactions.adoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[[tx]]
22
= Redis Transactions
33

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.
57

68
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:
79

@@ -20,7 +22,8 @@ List<Object> txResults = redisTemplate.execute(new SessionCallback<List<Object>>
2022
System.out.println("Number of items added to set: " + txResults.get(0));
2123
----
2224

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.
2427

2528
include::version-note.adoc[]
2629

@@ -74,7 +77,9 @@ public class RedisTxContextConfiguration {
7477
----
7578
<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].
7679
<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.
7883
====
7984

8085
The following examples each demonstrate a usage constraint:

src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public static void releaseConnection(@Nullable RedisConnection conn, RedisConnec
275275
* @param factory the Redis factory that the connection was created with.
276276
* @param transactionSupport whether transaction support is enabled.
277277
* @since 2.1.9
278-
* @deprecated since 2.4.0, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory)}
278+
* @deprecated since 2.4.2, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory)}
279279
*/
280280
@Deprecated
281281
public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory,
@@ -623,7 +623,7 @@ public void clear() {
623623
* Subinterface of {@link RedisConnection} to be implemented by {@link RedisConnection} proxies. Allows access to the
624624
* underlying target {@link RedisConnection}.
625625
*
626-
* @since 2.4
626+
* @since 2.4.2
627627
* @see RedisConnectionUtils#getTargetConnection(RedisConnection)
628628
*/
629629
interface RedisConnectionProxy extends RedisConnection, RawTargetAccess {

src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public <K, V> Object execute(RedisOperations<K, V> operations) throws DataAccess
136136
verify(redisConnectionMock).close();
137137
}
138138

139-
@Test // DATAREDIS-988
139+
@Test // DATAREDIS-988, DATAREDIS-891
140140
void transactionAwareTemplateShouldReleaseConnection() {
141141

142142
template.setEnableTransactionSupport(true);

0 commit comments

Comments
 (0)