Redis在java中的使用

1.添加价包

<!--Redis 依赖-->
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>1.7.2.RELEASE</version>
</dependency>
<!--连接池依赖-->
<dependency>
   <groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>

 2.配置文件

spring:
  data:
   redis:
      host: IP地址
      port: 6379
      password: 
      lettuce:
        pool:
          max-active: 8  #最大连接
          max-idle: 8  #最大空间连接
          max-wait: 100  #连接等待时间
          min-idle: 0  #最小空间连接

 

posted @ 2023-02-07 18:46  早日月薪五万  阅读(26)  评论(0编辑  收藏  举报