diff --git a/pom.xml b/pom.xml
index 94effee5e3..7d4b52f3ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.data
spring-data-redis
- 3.0.0-SNAPSHOT
+ 3.0.0-GH-2195-SNAPSHOT
Spring Data Redis
diff --git a/src/main/asciidoc/appendix/appendix-command-reference.adoc b/src/main/asciidoc/appendix/appendix-command-reference.adoc
index 0b571a3b04..256a080ef0 100644
--- a/src/main/asciidoc/appendix/appendix-command-reference.adoc
+++ b/src/main/asciidoc/appendix/appendix-command-reference.adoc
@@ -115,6 +115,7 @@
|RANDOMKEY |X
|RENAME |X
|RENAMENX |X
+|REPLICAOF |X
|RESTORE |X
|ROLE |-
|RPOP |X
diff --git a/src/main/java/org/springframework/data/redis/Version.java b/src/main/java/org/springframework/data/redis/Version.java
deleted file mode 100644
index 8bac1c9e24..0000000000
--- a/src/main/java/org/springframework/data/redis/Version.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2011-2022 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.redis;
-
-/**
- * A {@link Comparable} software version
- *
- * @author Jennifer Hickey
- * @author Christoph Strobl
- * @deprecated since 2.0, use {@link org.springframework.data.util.Version}.
- */
-public class Version implements Comparable {
-
- public static final Version UNKNOWN = new Version(0, 0, 0);
-
- Integer major;
- Integer minor;
- Integer patch;
-
- public Version(int major, int minor, int patch) {
- this.major = major;
- this.minor = minor;
- this.patch = patch;
- }
-
- public int compareTo(Version o) {
- if (this.major != o.major) {
- return this.major.compareTo(o.major);
- }
- if (this.minor != o.minor) {
- return this.minor.compareTo(o.minor);
- }
- if (this.patch != o.patch) {
- return this.patch.compareTo(o.patch);
- }
- return 0;
- }
-
- @Override
- public String toString() {
- return "" + major + "." + minor + "." + patch;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((major == null) ? 0 : major.hashCode());
- result = prime * result + ((minor == null) ? 0 : minor.hashCode());
- result = prime * result + ((patch == null) ? 0 : patch.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof Version)) {
- return false;
- }
- Version other = (Version) obj;
- if (major == null) {
- if (other.major != null) {
- return false;
- }
- } else if (!major.equals(other.major)) {
- return false;
- }
- if (minor == null) {
- if (other.minor != null) {
- return false;
- }
- } else if (!minor.equals(other.minor)) {
- return false;
- }
- if (patch == null) {
- if (other.patch != null) {
- return false;
- }
- } else if (!patch.equals(other.patch)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/src/main/java/org/springframework/data/redis/VersionParser.java b/src/main/java/org/springframework/data/redis/VersionParser.java
deleted file mode 100644
index 963935f22e..0000000000
--- a/src/main/java/org/springframework/data/redis/VersionParser.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2014-2022 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.redis;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.springframework.lang.Nullable;
-
-/**
- * Central class for reading version string (eg. {@literal 1.3.1}) into {@link Version}.
- *
- * @author Christoph Strobl
- * @since 1.3
- * @deprecated since 2.0, use {@link org.springframework.data.util.Version}.
- */
-public class VersionParser {
-
- private static final Pattern VERSION_MATCHER = Pattern.compile("([0-9]+)\\.([0-9]+)(\\.([0-9]+))?(.*)");
-
- /**
- * Parse version string {@literal eg. 1.1.1} to {@link Version}.
- *
- * @param version can be {@literal null}.
- * @return never {@literal null}.
- */
- public static Version parseVersion(@Nullable String version) {
-
- if (version == null) {
- return Version.UNKNOWN;
- }
-
- Matcher matcher = VERSION_MATCHER.matcher(version);
- if (matcher.matches()) {
- String major = matcher.group(1);
- String minor = matcher.group(2);
- String patch = matcher.group(4);
- return new Version(Integer.parseInt(major), minor != null ? Integer.parseInt(minor) : 0,
- patch != null ? Integer.parseInt(patch) : 0);
- }
-
- return Version.UNKNOWN;
- }
-
-}
diff --git a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
index 8aa8fe9bc7..07bc8190d9 100644
--- a/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/cache/RedisCacheConfiguration.java
@@ -17,7 +17,6 @@
import java.nio.charset.StandardCharsets;
import java.time.Duration;
-import java.util.Optional;
import java.util.function.Consumer;
import org.springframework.cache.Cache;
@@ -143,25 +142,6 @@ public RedisCacheConfiguration entryTtl(Duration ttl) {
valueSerializationPair, conversionService);
}
- /**
- * Use the given prefix instead of using the cache name.
- * This option replaces the cache name with {@code prefix} therefore we recommend rather using
- * {@link #prefixCacheNameWith(String)} or {@link #computePrefixWith(CacheKeyPrefix)} for more control.
- * The generated cache key will be: {@code prefix + cache entry key}.
- *
- * @param prefix must not be {@literal null}.
- * @return new {@link RedisCacheConfiguration}.
- * @deprecated since 2.3. Use {@link #prefixCacheNameWith(String)} or {@link #computePrefixWith(CacheKeyPrefix)}
- * instead.
- */
- @Deprecated
- public RedisCacheConfiguration prefixKeysWith(String prefix) {
-
- Assert.notNull(prefix, "Prefix must not be null!");
-
- return computePrefixWith((cacheName) -> prefix);
- }
-
/**
* Prefix the {@link RedisCache#getName() cache name} with the given value.
* The generated cache key will be: {@code prefix + cache name + "::" + cache entry key}.
@@ -261,15 +241,6 @@ public RedisCacheConfiguration serializeValuesWith(SerializationPair> valueSer
valueSerializationPair, conversionService);
}
- /**
- * @return never {@literal null}.
- * @deprecated since 2.0.4. Please use {@link #getKeyPrefixFor(String)}.
- */
- @Deprecated
- public Optional getKeyPrefix() {
- return usePrefix() ? Optional.of(keyPrefix.compute("")) : Optional.empty();
- }
-
/**
* Get the computed {@literal key} prefix for a given {@literal cacheName}.
*
diff --git a/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java
index 83a58bcbef..5c9a07a56b 100644
--- a/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/AbstractRedisConnection.java
@@ -31,7 +31,7 @@
* @author Mark Paluch
* @since 1.4
*/
-public abstract class AbstractRedisConnection implements DefaultedRedisConnection {
+public abstract class AbstractRedisConnection implements RedisConnection {
private @Nullable RedisSentinelConfiguration sentinelConfiguration;
private final Map connectionCache = new ConcurrentHashMap<>();
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java
index 51fba4f18d..4b6a9ab280 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterCommandExecutionFailureException.java
@@ -15,7 +15,6 @@
*/
package org.springframework.data.redis.connection;
-import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -32,8 +31,6 @@ public class ClusterCommandExecutionFailureException extends UncategorizedDataAc
private static final long serialVersionUID = 5727044227040368955L;
- private final Collection extends Throwable> causes;
-
/**
* Creates new {@link ClusterCommandExecutionFailureException}.
*
@@ -51,18 +48,8 @@ public ClusterCommandExecutionFailureException(Throwable cause) {
public ClusterCommandExecutionFailureException(List extends Throwable> causes) {
super(causes.get(0).getMessage(), causes.get(0));
- this.causes = causes;
causes.forEach(this::addSuppressed);
}
- /**
- * Get the collected errors.
- *
- * @return never {@literal null}.
- * @deprecated since 2.0, use {@link #getSuppressed()}.
- */
- public Collection extends Throwable> getCauses() {
- return causes;
- }
}
diff --git a/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java b/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java
index 1a9a57fe18..ac5b218d31 100644
--- a/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java
+++ b/src/main/java/org/springframework/data/redis/connection/ClusterTopology.java
@@ -55,8 +55,8 @@ public Set getNodes() {
}
/**
- * Get all nodes (master and slave) in cluster where {@code link-state} is {@literal connected} and {@code flags} does
- * not contain {@literal fail} or {@literal fail?}.
+ * Get all nodes (master and replica) in cluster where {@code link-state} is {@literal connected} and {@code flags}
+ * does not contain {@literal fail} or {@literal fail?}.
*
* @return never {@literal null}.
*/
@@ -105,7 +105,7 @@ public Set getMasterNodes() {
}
/**
- * Get the {@link RedisClusterNode}s (master and slave) serving s specific slot.
+ * Get the {@link RedisClusterNode}s (master and replica) serving s specific slot.
*
* @param slot
* @return never {@literal null}.
diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
index b9afb28f5d..fa3e9c5086 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringRedisConnection.java
@@ -48,6 +48,9 @@
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.connection.stream.StreamReadOptions;
import org.springframework.data.redis.connection.stream.StringRecord;
+import org.springframework.data.redis.connection.zset.DefaultTuple;
+import org.springframework.data.redis.connection.zset.Tuple;
+import org.springframework.data.redis.connection.zset.Weights;
import org.springframework.data.redis.core.ConvertingCursor;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
@@ -76,6 +79,7 @@
* @author dengliming
* @author ihaohong
*/
+@SuppressWarnings({ "ConstantConditions", "deprecation" })
public class DefaultStringRedisConnection implements StringRedisConnection, DecoratedRedisConnection {
private static final byte[][] EMPTY_2D_BYTE_ARRAY = new byte[0][];
@@ -180,6 +184,66 @@ public DefaultStringRedisConnection(RedisConnection connection, RedisSerializer<
this.byteGeoResultsToStringGeoResults = Converters.deserializingGeoResultsConverter(serializer);
}
+ @Override
+ public RedisCommands commands() {
+ return this;
+ }
+
+ @Override
+ public RedisGeoCommands geoCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisHashCommands hashCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisHyperLogLogCommands hyperLogLogCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisKeyCommands keyCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisListCommands listCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisSetCommands setCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisScriptingCommands scriptingCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisServerCommands serverCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisStreamCommands streamCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisStringCommands stringCommands() {
+ return this;
+ }
+
+ @Override
+ public RedisZSetCommands zSetCommands() {
+ return this;
+ }
+
@Override
public Long append(byte[] key, byte[] value) {
return convertAndReturn(delegate.append(key, value), Converters.identityConverter());
@@ -195,14 +259,6 @@ public void bgReWriteAof() {
delegate.bgReWriteAof();
}
- /**
- * @deprecated As of 1.3, use {@link #bgReWriteAof}.
- */
- @Deprecated
- public void bgWriteAof() {
- bgReWriteAof();
- }
-
@Override
public List bLPop(int timeout, byte[]... keys) {
return convertAndReturn(delegate.bLPop(timeout, keys), Converters.identityConverter());
@@ -1005,6 +1061,13 @@ public Set zInterWithScores(Aggregate aggregate, Weights weights, S
return convertAndReturn(delegate.zInterWithScores(aggregate, weights, serializeMulti(sets)), tupleToStringTuple);
}
+ @Nullable
+ @Override
+ public Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
+ return convertAndReturn(delegate.zInterStore(destKey, aggregate, Weights.of(weights), sets),
+ Converters.identityConverter());
+ }
+
@Override
public Long zInterStore(byte[] destKey, Aggregate aggregate, Weights weights, byte[]... sets) {
return convertAndReturn(delegate.zInterStore(destKey, aggregate, weights, sets), Converters.identityConverter());
@@ -1031,7 +1094,7 @@ public Set zRangeByScore(byte[] key, Range range) {
}
@Override
- public Set zRangeByScore(byte[] key, Range range, Limit limit) {
+ public Set zRangeByScore(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByScore(key, range, limit), Converters.identityConverter());
}
@@ -1052,7 +1115,8 @@ public Set zRangeByScoreWithScores(byte[] key, double min, double max, lo
}
@Override
- public Set zRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
+ public Set zRangeByScoreWithScores(byte[] key, Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByScoreWithScores(key, range, limit), Converters.identityConverter());
}
@@ -1082,7 +1146,7 @@ public Set zRevRangeByScore(byte[] key, double min, double max) {
}
@Override
- public Set zRevRangeByScore(byte[] key, Range range, Limit limit) {
+ public Set zRevRangeByScore(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByScore(key, range, limit), Converters.identityConverter());
}
@@ -1098,7 +1162,8 @@ public Set zRevRangeByScoreWithScores(byte[] key, Range range) {
}
@Override
- public Set zRevRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
+ public Set zRevRangeByScoreWithScores(byte[] key, Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByScoreWithScores(key, range, limit), Converters.identityConverter());
}
@@ -1203,6 +1268,13 @@ public Long zUnionStore(byte[] destKey, Aggregate aggregate, Weights weights, by
return convertAndReturn(delegate.zUnionStore(destKey, aggregate, weights, sets), Converters.identityConverter());
}
+ @Nullable
+ @Override
+ public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) {
+ return convertAndReturn(delegate.zUnionStore(destKey, aggregate, Weights.of(weights), sets),
+ Converters.identityConverter());
+ }
+
public Long zUnionStore(byte[] destKey, byte[]... sets) {
return convertAndReturn(delegate.zUnionStore(destKey, sets), Converters.identityConverter());
}
@@ -1295,7 +1367,6 @@ private GeoReference serialize(GeoReference data) {
: (GeoReference) data;
}
- @SuppressWarnings("unchecked")
private StreamOffset[] serialize(StreamOffset[] offsets) {
return Arrays.stream(offsets).map(it -> StreamOffset.create(serialize(it.getKey()), it.getOffset()))
@@ -2433,13 +2504,13 @@ public List getClientList() {
}
@Override
- public void slaveOf(String host, int port) {
- this.delegate.slaveOf(host, port);
+ public void replicaOf(String host, int port) {
+ this.delegate.replicaOf(host, port);
}
@Override
- public void slaveOfNoOne() {
- this.delegate.slaveOfNoOne();
+ public void replicaOfNoOne() {
+ this.delegate.replicaOfNoOne();
}
@Override
@@ -2578,7 +2649,7 @@ public Set zRangeByLex(byte[] key, Range range) {
}
@Override
- public Set zRangeByLex(byte[] key, Range range, Limit limit) {
+ public Set zRangeByLex(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByLex(key, range, limit), Converters.identityConverter());
}
@@ -2589,21 +2660,21 @@ public Set zRangeByLex(String key) {
@Override
public Set zRangeByLex(String key, Range range) {
- return zRangeByLex(key, range, Limit.unlimited());
+ return zRangeByLex(key, range, org.springframework.data.redis.connection.Limit.unlimited());
}
@Override
- public Set zRangeByLex(String key, Range range, Limit limit) {
+ public Set zRangeByLex(String key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRangeByLex(serialize(key), range, limit), byteSetToStringSet);
}
@Override
- public Set zRevRangeByLex(byte[] key, Range range, Limit limit) {
+ public Set zRevRangeByLex(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByLex(key, range, limit), Converters.identityConverter());
}
@Override
- public Set zRevRangeByLex(String key, Range range, Limit limit) {
+ public Set zRevRangeByLex(String key, Range range, org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.zRevRangeByLex(serialize(key), range, limit), byteSetToStringSet);
}
@@ -2709,7 +2780,8 @@ public PendingMessages xPending(String key, String groupName, XPendingOptions op
}
@Override
- public List xRange(String key, org.springframework.data.domain.Range range, Limit limit) {
+ public List xRange(String key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.xRange(serialize(key), range, limit), listByteMapRecordToStringMapRecordConverter);
}
@@ -2728,7 +2800,8 @@ public List xReadGroupAsString(Consumer consumer, StreamReadOption
}
@Override
- public List xRevRange(String key, org.springframework.data.domain.Range range, Limit limit) {
+ public List xRevRange(String key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return convertAndReturn(delegate.xRevRange(serialize(key), range, limit),
listByteMapRecordToStringMapRecordConverter);
@@ -2820,7 +2893,8 @@ public PendingMessages xPending(byte[] key, String groupName, XPendingOptions op
}
@Override
- public List xRange(byte[] key, org.springframework.data.domain.Range range, Limit limit) {
+ public List xRange(byte[] key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return delegate.xRange(key, range, limit);
}
@@ -2836,7 +2910,8 @@ public List xReadGroup(Consumer consumer, StreamReadOptions readOpti
}
@Override
- public List xRevRange(byte[] key, org.springframework.data.domain.Range range, Limit limit) {
+ public List xRevRange(byte[] key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return delegate.xRevRange(key, range, limit);
}
diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java b/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
index f681d992ea..6735c21ff7 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultStringTuple.java
@@ -17,8 +17,9 @@
import java.nio.charset.StandardCharsets;
-import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
+import org.springframework.data.redis.connection.zset.DefaultTuple;
+import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.util.ObjectUtils;
/**
diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
index fb853a0be4..6a06e07aa6 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisClusterConnection.java
@@ -15,21 +15,20 @@
*/
package org.springframework.data.redis.connection;
-import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.springframework.data.redis.core.types.RedisClientInfo;
-import org.springframework.lang.Nullable;
-import org.springframework.util.Assert;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
-public interface DefaultedRedisClusterConnection extends RedisClusterConnection, DefaultedRedisConnection {
+@Deprecated
+public interface DefaultedRedisClusterConnection
+ extends DefaultedRedisConnection, RedisClusterCommands, RedisClusterServerCommands, RedisClusterCommandsProvider {
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
@Override
@@ -150,24 +149,4 @@ default List getClientList(RedisClusterNode node) {
return serverCommands().getClientList(node);
}
- @Nullable
- @Override
- @SuppressWarnings("unchecked")
- default T execute(String command, byte[] key, Collection args) {
-
- Assert.notNull(command, "Command must not be null!");
- Assert.notNull(key, "Key must not be null!");
- Assert.notNull(args, "Args must not be null!");
-
- byte[][] commandArgs = new byte[args.size() + 1][];
-
- commandArgs[0] = key;
- int targetIndex = 1;
-
- for (byte[] binaryArgument : args) {
- commandArgs[targetIndex++] = binaryArgument;
- }
-
- return (T) execute(command, commandArgs);
- }
}
diff --git a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
index 624298bdb3..4c32134185 100644
--- a/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/DefaultedRedisConnection.java
@@ -40,6 +40,8 @@
import org.springframework.data.redis.connection.stream.StreamInfo.XInfoStream;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.connection.stream.StreamReadOptions;
+import org.springframework.data.redis.connection.zset.Tuple;
+import org.springframework.data.redis.connection.zset.Weights;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.Expiration;
@@ -62,7 +64,8 @@
* @author ihaohong
* @since 2.0
*/
-public interface DefaultedRedisConnection extends RedisConnection {
+@Deprecated
+public interface DefaultedRedisConnection extends RedisCommands, RedisCommandsProvider {
// KEY COMMANDS
@@ -584,7 +587,8 @@ default List xRange(byte[] key, org.springframework.data.domain.Rang
/** @deprecated in favor of {@link RedisConnection#streamCommands()}}. */
@Override
@Deprecated
- default List xRange(byte[] key, org.springframework.data.domain.Range range, Limit limit) {
+ default List xRange(byte[] key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return streamCommands().xRange(key, range, limit);
}
@@ -627,7 +631,8 @@ default List xRevRange(byte[] key, org.springframework.data.domain.R
/** @deprecated in favor of {@link RedisConnection#streamCommands()}}. */
@Override
@Deprecated
- default List xRevRange(byte[] key, org.springframework.data.domain.Range range, Limit limit) {
+ default List xRevRange(byte[] key, org.springframework.data.domain.Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return streamCommands().xRevRange(key, range, limit);
}
@@ -1136,28 +1141,29 @@ default Set zRangeWithScores(byte[] key, long start, long end) {
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRangeByLex(byte[] key, Range range, Limit limit) {
+ default Set zRangeByLex(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeByLex(key, range, limit);
}
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRevRangeByLex(byte[] key, Range range, Limit limit) {
+ default Set zRevRangeByLex(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRevRangeByLex(key, range, limit);
}
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRangeByScore(byte[] key, Range range, Limit limit) {
+ default Set zRangeByScore(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeByScore(key, range, limit);
}
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
+ default Set zRangeByScoreWithScores(byte[] key, Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRangeByScoreWithScores(key, range, limit);
}
@@ -1171,14 +1177,15 @@ default Set zRevRangeWithScores(byte[] key, long start, long end) {
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRevRangeByScore(byte[] key, Range range, Limit limit) {
+ default Set zRevRangeByScore(byte[] key, Range range, org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRevRangeByScore(key, range, limit);
}
/** @deprecated in favor of {@link RedisConnection#zSetCommands()}}. */
@Override
@Deprecated
- default Set zRevRangeByScoreWithScores(byte[] key, Range range, Limit limit) {
+ default Set zRevRangeByScoreWithScores(byte[] key, Range range,
+ org.springframework.data.redis.connection.Limit limit) {
return zSetCommands().zRevRangeByScoreWithScores(key, range, limit);
}
@@ -1583,13 +1590,6 @@ default void pfMerge(byte[] destinationKey, byte[]... sourceKeys) {
// SERVER COMMANDS
- /** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
- @Override
- @Deprecated
- default void bgWriteAof() {
- serverCommands().bgWriteAof();
- }
-
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
@Override
@Deprecated
@@ -1740,15 +1740,15 @@ default List getClientList() {
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
@Override
@Deprecated
- default void slaveOf(String host, int port) {
- serverCommands().slaveOf(host, port);
+ default void replicaOf(String host, int port) {
+ serverCommands().replicaOf(host, port);
}
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
@Override
@Deprecated
- default void slaveOfNoOne() {
- serverCommands().slaveOfNoOne();
+ default void replicaOfNoOne() {
+ serverCommands().replicaOfNoOne();
}
/** @deprecated in favor of {@link RedisConnection#serverCommands()}. */
diff --git a/src/main/java/org/springframework/data/redis/connection/Limit.java b/src/main/java/org/springframework/data/redis/connection/Limit.java
new file mode 100644
index 0000000000..7e8a6b8662
--- /dev/null
+++ b/src/main/java/org/springframework/data/redis/connection/Limit.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2022 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.data.redis.connection;
+
+/**
+ * @author Christoph Strobl
+ * @since 1.6
+ */
+public class Limit {
+
+ private static final Limit UNLIMITED = new Limit() {
+
+ @Override
+ public int getCount() {
+ return -1;
+ }
+
+ @Override
+ public int getOffset() {
+ return super.getOffset();
+ }
+ };
+
+ int offset;
+ int count;
+
+ public static Limit limit() {
+ return new Limit();
+ }
+
+ public Limit offset(int offset) {
+ this.offset = offset;
+ return this;
+ }
+
+ public Limit count(int count) {
+ this.count = count;
+ return this;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public boolean isUnlimited() {
+ return this.equals(UNLIMITED);
+ }
+
+ /**
+ * @return new {@link Limit} indicating no limit;
+ * @since 1.3
+ */
+ public static Limit unlimited() {
+ return UNLIMITED;
+ }
+}
diff --git a/src/main/java/org/springframework/data/redis/connection/PoolConfig.java b/src/main/java/org/springframework/data/redis/connection/PoolConfig.java
deleted file mode 100644
index 180d144b1c..0000000000
--- a/src/main/java/org/springframework/data/redis/connection/PoolConfig.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2013-2022 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.data.redis.connection;
-
-import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
-
-/**
- * Subclass of {@link GenericObjectPoolConfig} that includes setters for instantiation in Spring
- *
- * @author Jennifer Hickey
- * @author Christoph Strobl
- * @deprecated use {@link GenericObjectPoolConfig} instead. Will be removed in a future revision.
- */
-@Deprecated
-public class PoolConfig extends GenericObjectPoolConfig {
-
- public PoolConfig() {
- super();
- }
-
- public void setMaxActive(int maxActive) {
- setMaxTotal(maxActive);
- }
-}
diff --git a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
index 195b806932..86f91e0850 100644
--- a/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/ReactiveClusterCommands.java
@@ -46,22 +46,22 @@ public interface ReactiveClusterCommands {
Flux clusterGetNodes();
/**
- * Retrieve information about connected slaves for given master node.
+ * Retrieve information about connected replicas for given master node.
*
* @param master must not be {@literal null}.
* @return a {@link Flux} emitting {@link RedisClusterNode cluster nodes}, an {@link Flux#empty() empty one} if none
* found.
- * @see Redis Documentation: CLUSTER SLAVES
+ * @see Redis Documentation: CLUSTER REPLICAS
*/
- Flux clusterGetSlaves(RedisClusterNode master);
+ Flux clusterGetReplicas(RedisClusterNode master);
/**
- * Retrieve information about masters and their connected slaves.
+ * Retrieve information about masters and their connected replicas.
*
* @return never {@literal null}.
- * @see Redis Documentation: CLUSTER SLAVES
+ * @see Redis Documentation: CLUSTER REPLICAS
*/
- Mono