Spring Data Redis 2.2.6

Spring 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….

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());
}

}

Spring Initializr
Quickstart Your Project
Bootstrap your application with Spring Initializr.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值