SpringBoot JetCache redis.lettuce yml密码配置

/ Java / 没有评论 / 2818浏览

SpringBoot JetCache redis.lettuce yml密码配置

项目中使用了jetcache并使用remote远程redis缓存,type为redis.lettuce,搞半天不知道密码怎么配置,官网也没写,只能啃源码了,发现密码配置在uri上,做个记录。。

yml配置

jetcache:
  statIntervalMinutes: 30
  areaInCacheName: false
  local:
    default:
      type: caffeine
      keyConvertor: fastjson
      limit: 5000
      expireAfterWriteInMillis: 120000
  remote:
    default:
      type: redis.lettuce
      keyConvertor: fastjson
      valueEncoder: kryo
      valueDecoder: kryo
      # uri格式:redis://密码@ip:端口/redis库名?timeout=5s
      uri: redis://123456@127.0.0.1:6379/1?timeout=5s
      poolConfig:
        minIdle: 5
        maxIdle: 20
        maxTotal: 50