-
Notifications
You must be signed in to change notification settings - Fork 31
javayh redis starter 说明
杨海吉 edited this page Mar 5, 2020
·
1 revision
javayh-redis-starter 是项目缓存处理的核心依赖
单机版使用前,请先将 RedisAutoConfig关于集群配置的代码注释掉 ,打开后会有相关提示(73行注释掉)
spring:
redis:
host: 127.0.0.1
port: 6379
timeout: 6000
database: 1
lettuce:
pool:
max-active: 10
max-idle: 8
max-wait: 100
min-idle: 2
shutdown-timeout: 100ms
将上述73行代码去掉注释即可
spring:
redis:
host: 127.0.0.1
port: 6379
timeout: 6000
database: 1
lettuce:
pool:
max-active: 10
max-idle: 8
max-wait: 100
min-idle: 2
shutdown-timeout: 100ms
cluster:
nodes: 12.0.0.1:7000,12.0.0.1:7000
@Autowired
private RedisUtil redisUtil;
@GetMapping(value = "redis")
public ResultData redis(){
String ceshi = KeyUtils.key("ceshi");
boolean hello_word = redisUtil.setl(ceshi, "hello word", 100);
String s = (String) redisUtil.get(ceshi);
return ResultData.success(s);
}
KeyUtils作为缓存策略的前缀模板,可进行业务扩展
RedisUtil 内部也做了关于雪崩效应的处理方案
关注 Java有货领取更多资料 联系小编。微信:372787553,带您进群互相学习 左侧小编微信,右侧获取免费资料
- SpringCloud 自定义封装架构https://github.com/Dylan-haiji/javayh-platform
- Java 设计模式学习代码 https://github.com/Dylan-haiji/design-pattern
- SpringCloud学习代码: https://github.com/Dylan-haiji/javayh-cloud
- AlibabaCloud学习代码:https://github.com/Dylan-haiji/javayh-cloud-nacos
- SpringBoot+Mybatis 多数据源切换:https://github.com/Dylan-haiji/javayh-boot-data-soure
- Redis、Mongo、Rabbitmq、Kafka学习代码: https://github.com/Dylan-haiji/javayh-middleware
- SpringBoot+SpringSecurity实现自定义登录学习代码:https://github.com/Dylan-haiji/javayh-distribution