有没有spring数据redis映射redisson框架

Is there a spring data redis mapping the Redisson framework

如题所说,有没有spring数据redis映射到Redisson框架(http://redisson.org)

简答

Spring Data Redis integration

长答案

Spring Data Redis integration视为另一种类型的连接器绑定(检查此处 对于 连接器 术语)。该库提供 RedissonConnectionFactory (implements RedisConnectionFactory) ,这将是使用例如的基础。 @RedisHash 和 spring 缓存抽象 (@EnableCaching)。还有一个 redisson-spring-boot-starter 但确保在类路径中没有 lettucejedis 因为 org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration (由 spring-boot-autoconfigure 提供)可能会在 org.redisson.spring.starter.RedissonAutoConfiguration 之前创建一个 RedisConnectionFactory(由 redisson-spring-boot-starter 提供)!

  1. 将 redisson-spring-boot-starter 依赖项添加到您的项目中:

    编译'org.redisson:redisson-spring-boot-starter:3.13.5'

  2. 将设置添加到 application.settings 文件

常用spring引导道具:

spring:
      redis:
        database: 
        host:
        port:
        password:
        ssl: 
        timeout:
        cluster:
          nodes:
        sentinel:
          master:
          nodes:
    
        
      redisson: 
        file: classpath:redisson.yaml
        config: |
          clusterServersConfig:
            idleConnectionTimeout: 10000
            connectTimeout: 10000
            timeout: 3000
            retryAttempts: 3
            retryInterval: 1500
            failedSlaveReconnectionInterval: 3000
            failedSlaveCheckInterval: 60000
            password: null
            subscriptionsPerConnection: 5
            clientName: null
            loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
            subscriptionConnectionMinimumIdleSize: 1
            subscriptionConnectionPoolSize: 50
            slaveConnectionMinimumIdleSize: 24
            slaveConnectionPoolSize: 64
            masterConnectionMinimumIdleSize: 24
            masterConnectionPoolSize: 64
            readMode: "SLAVE"
            subscriptionMode: "SLAVE"
            nodeAddresses:
            - "redis://127.0.0.1:7004"
            - "redis://127.0.0.1:7001"
            - "redis://127.0.0.1:7000"
            scanInterval: 1000
            pingConnectionInterval: 0
            keepAlive: false
            tcpNoDelay: false
          threads: 16
          nettyThreads: 32
          codec: !<org.redisson.codec.FstCodec> {}
          transportMode: "NIO"

3.通过具有 RedissonClient 接口的 spring bean 或 RedisTemplate/ReactiveRedisTemplate 对象使用 Redisson