DATAREDIS-891 - Update documentation.

Update since tags, add issue reference and fix new line issues in reference documentation.

Original Pull Request: #573
This commit is contained in:
Christoph Strobl
2020-12-07 09:59:47 +01:00
parent 1912d0c999
commit 7d2bf8f852
3 changed files with 11 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
[[tx]]
= Redis Transactions
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.
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.
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:
@@ -20,7 +22,8 @@ List<Object> txResults = redisTemplate.execute(new SessionCallback<List<Object>>
System.out.println("Number of items added to set: " + txResults.get(0));
----
`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.
`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.
include::version-note.adoc[]
@@ -74,7 +77,9 @@ public class RedisTxContextConfiguration {
----
<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].
<2> Configures `RedisTemplate` to participate in transactions by binding connections to the current thread.
<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.
<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.
====
The following examples each demonstrate a usage constraint:

View File

@@ -275,7 +275,7 @@ public abstract class RedisConnectionUtils {
* @param factory the Redis factory that the connection was created with.
* @param transactionSupport whether transaction support is enabled.
* @since 2.1.9
* @deprecated since 2.4.0, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory)}
* @deprecated since 2.4.2, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory)}
*/
@Deprecated
public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory,
@@ -623,7 +623,7 @@ public abstract class RedisConnectionUtils {
* Subinterface of {@link RedisConnection} to be implemented by {@link RedisConnection} proxies. Allows access to the
* underlying target {@link RedisConnection}.
*
* @since 2.4
* @since 2.4.2
* @see RedisConnectionUtils#getTargetConnection(RedisConnection)
*/
interface RedisConnectionProxy extends RedisConnection, RawTargetAccess {

View File

@@ -136,7 +136,7 @@ class RedisTemplateUnitTests {
verify(redisConnectionMock).close();
}
@Test // DATAREDIS-988
@Test // DATAREDIS-988, DATAREDIS-891
void transactionAwareTemplateShouldReleaseConnection() {
template.setEnableTransactionSupport(true);