8、Redis整合SpringBoot

1、依赖导入

<!-- redis -->

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-redis</artifactId>

</dependency>

<!-- spring2.X集成redis所需common-pool2-->

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-pool2</artifactId>

<version>2.6.0</version>

</dependency>

2、application.yml文件配置

spring:

redis:

#Redis服务器地址

host: 175.178.27.250

#Redis密码

password: root123

#Redis服务器连接端口

port: 6379

#Redis数据库索引(默认为0)

database: 0

#连接超时时间(毫秒)

timeout: 1800000

#连接池配置

lettuce:

pool:

#连接池最大连接数(使用负值表示没有限制)

max-active: 20

#最大阻塞等待时间(负数表示没限制)

max-wait: -1

#连接池中的最大空闲连接

max-idle: 5

#连接池中的最小空闲连接

min-idle: 0

posted @   枫叶红时  阅读(21)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
· 面试官:你是如何进行SQL调优的?

阅读目录(Content)

此页目录为空

点击右上角即可分享
微信分享提示