スプリングboot-starter-data-redisの構成変更について

1594 ワード

シーケンス
本文は主にspring-boot-starter-data-redisの構成変更を検討する
構成の変更
以前はspring-bootの1.4でした.xバージョン(spring-data-redisは1.7.xバージョン)は、最近2.0.4にカットされた.RELEASEBバージョン(spring-data-redisが2.0.5.RELEASEバージョン)では、構成の変更が見つかりました.
旧バージョンの構成
spring.redis.database=0
spring.redis.host=192.168.99.100
spring.redis.port=6379
#spring.redis.password= # Login password of the redis server.
spring.redis.pool.max-active=8
spring.redis.pool.max-idle=8
spring.redis.pool.max-wait=-1
spring.redis.pool.min-idle=0
#spring.redis.sentinel.master= # Name of Redis server.
#spring.redis.sentinel.nodes= # Comma-separated list of host:port pairs.
spring.redis.timeout=10

新しいバージョン構成
spring.redis.database=0
spring.redis.host=192.168.99.100
spring.redis.port=6379
#spring.redis.password= # Login password of the redis server.
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.max-idle=8
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.min-idle=0
#spring.redis.sentinel.master= # Name of Redis server.
#spring.redis.sentinel.nodes= # Comma-separated list of host:port pairs.
spring.redis.timeout=100ms

小結
新しいspring-boot-starter-data-redisには、次のような変更があります.
  • spring.redisの下では、共通の構成に加えて、2つの異なる実装を区別し、jedisおよびlettuce
  • 共通構成spring.redis.timeoutのパラメータをDurationタイプに変更するには、時間単位パラメータ
  • を追加する必要がある
  • spring-boot-starter-data-redis新版デフォルトはlettuce
  • を使用します.
  • redis接続プールではcommons-pool 2クラスライブラリを導入する必要があります.このクラスライブラリの新しいバージョンのコアクラスの一部が変更されているため、バージョン番号2.4.3を超えると問題が発生する可能性があります.
  • doc
  • spring data redis reference