配置redis
docker安裝redis教程很多 再用到的時候自己搜一下吧
pom:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
application.properties:
#=========redis基礎配置=========
spring.redis.database=0
spring.redis.host=127.0.0.1
spring.redis.port=6390
#連接超時時間 單位 ms(毫秒)
spring.redis.timeout=3000
#=========redis線程池設置=========
#連接池中的最大空閒連接,默認值也是8。
spring.redis.pool.max-idle=200
#連接池中的最小空閒連接,默認值也是0。
spring.redis.pool.min-idle=200
#如果賦值爲-1,則表示不限制;pool已經分配了maxActive個jedis實例,則此時pool的狀態爲exhausted(耗盡)。
spring.redis.pool.max-active=2000
#等待可用連接的最大時間,單位毫秒,默認值爲-1,表示永不超時
spring.redis.pool.max-wait=1000