springboot操作redis三种方案
参考网址:
https://mp.weixin.qq.com/s/cgDtmjPWTdh44bSlLC0Qsw
方案一:Spring Data Redis
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
两个关键模板类
StringRedisTemplate
RedisTemplate
(可以配置自定义序列化 , 默认使用的是 jdk 序列化)
方案二: Spring Cache
参考:
https://mp.weixin.qq.com/s?__biz=MzI1NDY0MTkzNQ==&mid=2247485118&idx=1&sn=8eade859e76c504adc423d8e3598721b&scene=21#wechat_redirect
方案三:原始 jedis
参考:
https://mp.weixin.qq.com/s?__biz=MzI1NDY0MTkzNQ==&mid=2247484544&idx=1&sn=a8cd2836d12dabbddac980d56539d3a7&scene=21#wechat_redirect