原标题:Springboot使用RedisTemplate优雅地操作redis
概述
本文内容主要
关于spring-redis
关于redis的key设计
redis的基本数据结构
介绍redis与springboot的整合
sringboot中的redistemplate的使用
关于spring-redis
spring-data-redis针对jedis提供了如下功能:
1.连接池自动管理,提供了一个高度封装的“RedisTemplate”类
2.针对jedis客户端中大量api进行了归类封装,将同一类型操作封装为operation接口
ValueOperations:简单K-V操作
SetOperations:set类型数据操作
ZSetOperations:zset类型数据操作
HashOperations:针对map类型的数据操作
ListOperations:针对list类型的数据操作
3.提供了对key的“bound”(绑定)便捷化操作API,可以通过bound封装指定的key,然后进行一系列的操作而无须“显式”的再次指定Key,即BoundKeyOperations:
BoundValueOperations
BoundSetOperations
BoundListOperations
BoundSetOperations
BoundHashOperations
4.将事务操作封装,有容器控制。
5.针对数据的“序列化/反序列化”,提供了多种可选择策略(Redis