Spring Data Redis
2.7.2Spring Data Redis, part of the larger Spring Data family, provides easy configuration and access to Redis from Spring applications. It offers both low-level and high-level abstractions for interacting with the store, freeing the user from infrastructural concerns.
Features
-
Connection package as low-level abstraction across multiple Redis drivers(Lettuce and Jedis).
-
Exception translation to Spring’s portable Data Access exception hierarchy for Redis driver exceptions.
-
RedisTemplate that provides a high-level abstraction for performing various Redis operations, exception translation and serialization support.
-
Pubsub support (such as a MessageListenerContainer for message-driven POJOs).
-
Redis Sentinel and Redis Cluster support.
-
Reactive API using the Lettuce driver.
-
JDK, String, JSON and Spring Object/XML mapping serializers.
-
JDK Collection implementations on top of Redis.
-
Atomic counter support classes.
-
Sorting and Pipelining functionality.
-
Dedicated support for SORT, SORT/GET pattern and returned bulk values.
-
Redis implementation for Spring 3.1 cache abstraction.
-
Automatic implementation of
Repository
interfaces including support for custom query methods using@EnableRedisRepositories
. -
CDI support for repositories.
Configure RedisTemplate….
<bean id="jedisConnFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:use-pool="true"/>
<!-- redis template definition -->
<bean id="redisTemplate"
class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="jedisConnFactory"/>
Inject and use RedisTemplate or any of its opsForX() instances….
public class Example {
// inject the actual template
@Autowired
private RedisTemplate<String, String> template;
// inject the template as ListOperations
// can also inject as Value, Set, ZSet, and HashOperations
@Resource(name="redisTemplate")
private ListOperations<String, String> listOps;
public void addLink(String userId, URL url) {
listOps.leftPush(userId, url.toExternalForm());
// or use template directly
redisTemplate.boundListOps(userId).leftPush(url.toExternalForm());
}
}
Quickstart Your Project
Documentation
2.7.2 CURRENT GA | Reference Doc. | API Doc. |
3.0.0-SNAPSHOT SNAPSHOT | ||
3.0.0-M5 PRE | Reference Doc. | API Doc. |
2.7.3-SNAPSHOT SNAPSHOT | ||
2.6.7-SNAPSHOT SNAPSHOT | ||
2.6.6 GA | Reference Doc. | API Doc. |
2.5.12-SNAPSHOT SNAPSHOT | ||
2.5.11 GA | Reference Doc. | API Doc. |
Branch | Initial Release | End of Support | End Commercial Support * |
---|---|---|---|
2.7.x
|
2022-05-01 | 2023-05-01 | 2024-09-01 |
2.6.x
|
2021-11-12 | 2022-11-12 | 2024-03-12 |
2.5.x
|
2021-04-14 | 2022-04-14 | 2023-08-14 |
2.4.x
|
2020-10-28 | 2021-10-28 | 2023-02-28 |
2.3.x
|
2020-05-12 | 2021-05-12 | 2022-09-12 |
2.2.x
|
2019-09-30 | 2020-09-30 | 2022-01-30 |
2.1.x
|
2018-09-21 | 2019-09-21 | 2021-01-21 |
OSS support
Free security updates and bugfixes with support from the Spring community. See VMware Tanzu OSS support policy.
Commercial support
Business support from Spring experts during the OSS timeline, plus extended support after OSS End-Of-Life.
Publicly available releases for critical bugfixes and security issues when requested by customers.
Future release
Generation not yet released, timeline is subject to changes.