Migration Guides

  • 弃用和删除的类型,如 o.s.d.redis.connection.zset.Aggregate

  • 更改后的方法和类型,如 o.s.d.redis.core.RedisTemplate#executedoWithKeys

  • Jedis 驱动程序的变更,如在 o.s.d.redis.connection.jedis.JedisConnectionFactory 中使用 Connection 实例。

  • 管道和事务现在相互排斥,服务器命令在管道/事务模式中不可用。

  • LettucePool 已被移除,池化参数现由 LettuceConnectionFactory 和 LettuceConnection 上的更新方法处理。

本部分包含有关迁移步骤、弃用和删除的详细信息。

Upgrading from 2.x to 3.x

Re-/moved Types

Type Replacement

o.s.d.redis.Version

o.s.d.util.Version

o.s.d.redis.VersionParser

-

o.s.d.redis.connection.RedisZSetCommands.Aggregate

o.s.d.redis.connection.zset.Aggregate

o.s.d.redis.connection.RedisZSetCommands.Tuple

o.s.d.redis.connection.zset.Tuple

o.s.d.redis.connection.RedisZSetCommands.Weights

o.s.d.redis.connection.zset.Weights

o.s.d.redis.connection.RedisZSetCommands.Range

o.s.d.domain.Range

o.s.d.redis.connection.RedisZSetCommands.Limit

o.s.d.redis.connection.Limit.java

o.s.d.redis.connection.jedis.JedisUtils

-

o.s.d.redis.connection.jedis.JedisVersionUtil

-

o.s.d.redis.core.convert.CustomConversions

o.s.d.convert.CustomConversions

Changed Methods and Types

Table 1. Core
Type Method Replacement

o.s.d.redis.core.Cursor

open

-

o.s.d.redis.core.RedisTemplate

execute

doWithKeys

o.s.d.redis.stream.StreamMessageListenerContainer

isAutoAck

isAutoAcknowledge

o.s.d.redis.stream.StreamMessageListenerContainer

autoAck

autoAcknowledge

Table 2. Redis Connection
Type Method Replacement

o.s.d.redis.connection.ClusterCommandExecutionFailureException

getCauses

getSuppressed

o.s.d.redis.connection.RedisConnection

bgWriteAof

bgReWriteAof

o.s.d.redis.connection.RedisConnection

slaveOf

replicaOf

o.s.d.redis.connection.RedisConnection

slaveOfNoOne

replicaOfNoOne

o.s.d.redis.connection.ReactiveClusterCommands

clusterGetSlaves

clusterGetReplicas

o.s.d.redis.connection.ReactiveClusterCommands

clusterGetMasterSlaveMap

clusterGetMasterReplicaMap

o.s.d.redis.connection.ReactiveKeyCommands

getNewName

getNewKey

o.s.d.redis.connection.RedisClusterNode.Flag

SLAVE

REPLICA

o.s.d.redis.connection.RedisClusterNode.Builder

slaveOf

replicaOf

o.s.d.redis.connection.RedisNode

isSlave

isReplica

o.s.d.redis.connection.RedisSentinelCommands

slaves

replicas

o.s.d.redis.connection.RedisServer

getNumberSlaves

getNumberReplicas

o.s.d.redis.connection.RedisServerCommands

slaveOf

replicaOf

o.s.d.redis.core.ClusterOperations

getSlaves

getReplicas

o.s.d.redis.core.RedisOperations

slaveOf

replicaOf

Table 3. Redis Operations
Type Method Replacement

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoAdd

add

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoDist

distance

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoHash

hash

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoPos

position

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoRadius

radius

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoRadiusByMember

radius

o.s.d.redis.core.GeoOperations & BoundGeoOperations

geoRemove

remove

Table 4. Redis Cache
Type Method Replacement

o.s.d.redis.cache.RedisCacheConfiguration

prefixKeysWith

prefixCacheNameWith

o.s.d.redis.cache.RedisCacheConfiguration

getKeyPrefix

getKeyPrefixFor

Jedis

请阅读 Jedis upgrading guide,其中介绍了重要的驱动程序更改。

Table 5. Jedis Redis Connection
Type Method Replacement

o.s.d.redis.connection.jedis.JedisConnectionFactory

getShardInfo

can be obtained via JedisClientConfiguration

o.s.d.redis.connection.jedis.JedisConnectionFactory

setShardInfo

can be set via JedisClientConfiguration

o.s.d.redis.connection.jedis.JedisConnectionFactory

createCluster

now requires a Connection instead of Jedis instance

o.s.d.redis.connection.jedis.JedisConverters

has package visibility now

o.s.d.redis.connection.jedis.JedisConverters

tuplesToTuples

-

o.s.d.redis.connection.jedis.JedisConverters

tuplesToTuples

-

o.s.d.redis.connection.jedis.JedisConverters

stringListToByteList

-

o.s.d.redis.connection.jedis.JedisConverters

stringSetToByteSet

-

o.s.d.redis.connection.jedis.JedisConverters

stringMapToByteMap

-

o.s.d.redis.connection.jedis.JedisConverters

tupleSetToTupleSet

-

o.s.d.redis.connection.jedis.JedisConverters

toTupleSet

-

o.s.d.redis.connection.jedis.JedisConverters

toDataAccessException

o.s.d.redis.connection.jedis.JedisExceptionConverter#convert

Transactions / Pipelining

管道和事务现在相互排斥。在管道/事务模式中使用服务器或连接命令不再可能。

Lettuce

Lettuce Pool

`LettucePool`及其实现 `DefaultLettucePool`已被移除,没有替换。有关驱动程序的本机池功能,请参考 driver documentation。已更新接受池参数的方法。这影响了 `LettuceConnectionFactory`和 `LettuceConnection`上的方法。

Lettuce Authentication

`AuthenticatingRedisClient`已被移除,没有替换。有关 `RedisURI`的 driver documentation,请参考 driver documentation以设置身份验证数据。