美文网首页
spring-boot整合redis

spring-boot整合redis

作者: MaJiT | 来源:发表于2020-07-29 12:04 被阅读0次

    1.添加依赖

    <!-- Redis -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-redis</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-pool2</artifactId>
            </dependency>
    

    2.配置参数

    #redis 配置
      redis:
        database: 0
        host: 127.0.0.1
        lettuce:
          pool:
            max-active: 8   #最大连接数据库连接数,设 0 为没有限制
            max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
            max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
            min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
          shutdown-timeout: 100ms
        password: ''
        port: 6379
    

    相关文章

      网友评论

          本文标题:spring-boot整合redis

          本文链接:https://www.haomeiwen.com/subject/dujqrktx.html