result = connection.getCluster().zscan(key,
JedisConverters.toBytes(cursorId), params);
- return new ScanIteration<>(Long.valueOf(result.getCursor()),
+ return new ScanIteration<>(CursorId.of(result.getCursor()),
JedisConverters.tuplesToTuples().convert(result.getResult()));
}
}.open();
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
index 83acd8d07a..840f49dd04 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
index ba3575536a..4e83c271cf 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
@@ -78,8 +78,9 @@
* This connection factory implements {@link InitializingBean} and {@link SmartLifecycle} for flexible lifecycle
* control. It must be {@link #afterPropertiesSet() initialized} and {@link #start() started} before you can obtain a
* connection. {@link #afterPropertiesSet() Initialization} {@link SmartLifecycle#start() starts} this bean
- * {@link #isAutoStartup() by default}. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() restart}
- * this connection factory if needed.
+ * {@link #isEarlyStartup() early} by default. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start()
+ * restart} this connection factory if needed. Disabling {@link #isEarlyStartup() early startup} leaves lifecycle
+ * management to the container refresh if {@link #isAutoStartup() auto-startup} is enabled.
*
* Note that {@link JedisConnection} and its {@link JedisClusterConnection clustered variant} are not Thread-safe and
* instances should not be shared across threads. Refer to the
@@ -103,9 +104,10 @@ public class JedisConnectionFactory
private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy(
JedisExceptionConverter.INSTANCE);
- private boolean convertPipelineAndTxResults = true;
-
private int phase = 0; // in between min and max values
+ private boolean autoStartup = true;
+ private boolean earlyStartup = true;
+ private boolean convertPipelineAndTxResults = true;
private final AtomicReference state = new AtomicReference<>(State.CREATED);
@@ -494,8 +496,8 @@ public int getDatabase() {
* Sets the index of the database used by this connection factory. Default is 0.
*
* @param index database index.
- * @deprecated since 2.0, configure the client name using {@link RedisSentinelConfiguration} or
- * {@link RedisStandaloneConfiguration}.
+ * @deprecated since 2.0, configure the database index using {@link RedisStandaloneConfiguration} or
+ * {@link RedisSentinelConfiguration}.
*/
@Deprecated
public void setDatabase(int index) {
@@ -571,6 +573,70 @@ public RedisClusterConfiguration getClusterConfiguration() {
return RedisConfiguration.isClusterConfiguration(configuration) ? (RedisClusterConfiguration) configuration : null;
}
+ @Override
+ public int getPhase() {
+ return this.phase;
+ }
+
+ /**
+ * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}.
+ *
+ * @since 3.2
+ * @see SmartLifecycle#getPhase()
+ */
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ /**
+ * @since 3.3
+ */
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+
+ /**
+ * Configure if this Lifecycle connection factory should get started automatically by the container at the time that
+ * the containing ApplicationContext gets refreshed.
+ *
+ * This connection factory defaults to early auto-startup during {@link #afterPropertiesSet()} and can potentially
+ * create Redis connections early on in the lifecycle. See {@link #setEarlyStartup(boolean)} for delaying connection
+ * creation to the ApplicationContext refresh if auto-startup is enabled.
+ *
+ * @param autoStartup {@literal true} to automatically {@link #start()} the connection factory; {@literal false}
+ * otherwise.
+ * @since 3.3
+ * @see #setEarlyStartup(boolean)
+ * @see #start()
+ */
+ public void setAutoStartup(boolean autoStartup) {
+ this.autoStartup = autoStartup;
+ }
+
+ /**
+ * @return whether to {@link #start()} the component during {@link #afterPropertiesSet()}.
+ * @since 3.3
+ */
+ public boolean isEarlyStartup() {
+ return this.earlyStartup;
+ }
+
+ /**
+ * Configure if this InitializingBean's component Lifecycle should get started early by {@link #afterPropertiesSet()}
+ * at the time that the bean is initialized. The component defaults to auto-startup.
+ *
+ * This method is related to {@link #setAutoStartup(boolean) auto-startup} and can be used to delay Redis client
+ * startup until the ApplicationContext refresh. Disabling early startup does not disable auto-startup.
+ *
+ * @param earlyStartup {@literal true} to early {@link #start()} the component; {@literal false} otherwise.
+ * @since 3.3
+ * @see #setAutoStartup(boolean)
+ */
+ public void setEarlyStartup(boolean earlyStartup) {
+ this.earlyStartup = earlyStartup;
+ }
+
/**
* Specifies if pipelined results should be converted to the expected data type. If {@code false}, results of
* {@link JedisConnection#closePipeline()} and {@link JedisConnection#exec()} will be of the type returned by the
@@ -616,7 +682,7 @@ public void afterPropertiesSet() {
this.clientConfig = createClientConfig(getDatabase(), getRedisUsername(), getRedisPassword());
- if (isAutoStartup()) {
+ if (isEarlyStartup()) {
start();
}
}
@@ -724,21 +790,6 @@ public void stop() {
}
}
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}.
- *
- * @since 3.2
- * @see SmartLifecycle#getPhase()
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
@Override
public boolean isRunning() {
return State.STARTED.equals(this.state.get());
@@ -1006,8 +1057,8 @@ private void assertInitialized() {
switch (current) {
case CREATED, STOPPED -> throw new IllegalStateException(
String.format("JedisConnectionFactory has been %s. Use start() to initialize it", current));
- case DESTROYED -> throw new IllegalStateException(
- "JedisConnectionFactory was destroyed and cannot be used anymore");
+ case DESTROYED ->
+ throw new IllegalStateException("JedisConnectionFactory was destroyed and cannot be used anymore");
default -> throw new IllegalStateException(String.format("JedisConnectionFactory is %s", current));
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
index a095b943db..7a4c15613c 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
@@ -75,6 +75,7 @@
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.connection.zset.DefaultTuple;
import org.springframework.data.redis.connection.zset.Tuple;
+import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
@@ -175,6 +176,17 @@ public static byte[] toBytes(Number source) {
return toBytes(String.valueOf(source));
}
+ /**
+ * Convert the given {@link org.springframework.data.redis.core.Cursor.CursorId} into its binary representation.
+ *
+ * @param source must not be {@literal null}.
+ * @return the binary representation.
+ * @since 3.3
+ */
+ static byte[] toBytes(Cursor.CursorId source) {
+ return toBytes(source.getCursorId());
+ }
+
@Nullable
public static byte[] toBytes(@Nullable String source) {
return source == null ? null : SafeEncoder.encode(source);
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
index 15cd693c99..743565b76a 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisExceptionConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
index a91cbe7bd1..a5f806974d 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
index 419d19d3f8..be2cf8bb90 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -30,6 +30,7 @@
import org.springframework.data.redis.connection.RedisHashCommands;
import org.springframework.data.redis.connection.convert.Converters;
import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -149,8 +150,7 @@ public List> hRandFieldWithValues(byte[] key, long count)
List> convertedMapEntryList = new ArrayList<>(mapEntryList.size());
- mapEntryList.forEach(entry ->
- convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue())));
+ mapEntryList.forEach(entry -> convertedMapEntryList.add(Converters.entryOf(entry.getKey(), entry.getValue())));
return convertedMapEntryList;
@@ -219,24 +219,17 @@ public List hVals(byte[] key) {
@Override
public Cursor> hScan(byte[] key, ScanOptions options) {
- return hScan(key, 0, options);
+ return hScan(key, CursorId.initial(), options);
}
- /**
- * @since 1.4
- * @param key
- * @param cursorId
- * @param options
- * @return
- */
- public Cursor> hScan(byte[] key, long cursorId, ScanOptions options) {
+ public Cursor> hScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor>(key, cursorId, options) {
@Override
- protected ScanIteration> doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration> doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (isQueueing() || isPipelined()) {
throw new InvalidDataAccessApiUsageException("'HSCAN' cannot be called in pipeline / transaction mode");
@@ -244,9 +237,9 @@ protected ScanIteration> doScan(byte[] key, long cursorId,
ScanParams params = JedisConverters.toScanParams(options);
- ScanResult> result = connection.getJedis().hscan(key, JedisConverters.toBytes(cursorId),
- params);
- return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult());
+ ScanResult> result = connection.getJedis().hscan(key,
+ JedisConverters.toBytes(cursorId), params);
+ return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult());
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
index 16e08ad611..64e7dc92e1 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java
index ef1771969d..8d7a1cf2d3 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisInvoker.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
index 1e3f455829..58fc4e2408 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -36,6 +36,7 @@
import org.springframework.data.redis.connection.ValueEncoding.RedisValueEncoding;
import org.springframework.data.redis.connection.convert.Converters;
import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.KeyScanOptions;
import org.springframework.data.redis.core.ScanCursor;
import org.springframework.data.redis.core.ScanIteration;
@@ -131,7 +132,7 @@ public Set keys(byte[] pattern) {
@Override
public Cursor scan(ScanOptions options) {
- return scan(0, options != null ? options : ScanOptions.NONE);
+ return scan(CursorId.initial(), options != null ? options : ScanOptions.NONE);
}
/**
@@ -140,12 +141,12 @@ public Cursor scan(ScanOptions options) {
* @param options
* @return
*/
- public Cursor scan(long cursorId, ScanOptions options) {
+ public Cursor scan(CursorId cursorId, ScanOptions options) {
return new ScanCursor(cursorId, options) {
@Override
- protected ScanIteration doScan(long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(CursorId cursorId, ScanOptions options) {
if (isQueueing() || isPipelined()) {
throw new InvalidDataAccessApiUsageException("'SCAN' cannot be called in pipeline / transaction mode");
@@ -165,12 +166,12 @@ protected ScanIteration doScan(long cursorId, ScanOptions options) {
}
if (type != null) {
- result = connection.getJedis().scan(Long.toString(cursorId).getBytes(), params, type);
+ result = connection.getJedis().scan(JedisConverters.toBytes(cursorId), params, type);
} else {
- result = connection.getJedis().scan(Long.toString(cursorId).getBytes(), params);
+ result = connection.getJedis().scan(JedisConverters.toBytes(cursorId), params);
}
- return new ScanIteration<>(Long.parseLong(result.getCursor()), result.getResult());
+ return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult());
}
protected void doClose() {
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
index b2ed65e496..fc3e54259a 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
index 70c81a7a15..e44685e32b 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisMessageListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
index 3f96bb0b91..ca68b02d43 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
index 4302b917d1..d7a2223a18 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptReturnConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
index 4efa40faeb..13eb3178b4 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java
index 291cb373f6..8af29b6792 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSentinelConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
index fddd3cc374..bab0522591 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
index 654b0b5c47..c9ed8280de 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -27,6 +27,7 @@
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.RedisSetCommands;
import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -206,24 +207,24 @@ public Long sUnionStore(byte[] destKey, byte[]... keys) {
@Override
public Cursor sScan(byte[] key, ScanOptions options) {
- return sScan(key, 0, options);
+ return sScan(key, CursorId.initial(), options);
}
/**
- * @since 1.4
* @param key
* @param cursorId
* @param options
* @return
+ * @since 3.2.1
*/
- public Cursor sScan(byte[] key, long cursorId, ScanOptions options) {
+ public Cursor sScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor(key, cursorId, options) {
@Override
- protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (isQueueing() || isPipelined()) {
throw new InvalidDataAccessApiUsageException("'SSCAN' cannot be called in pipeline / transaction mode");
@@ -232,7 +233,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions op
ScanParams params = JedisConverters.toScanParams(options);
ScanResult result = connection.getJedis().sscan(key, JedisConverters.toBytes(cursorId), params);
- return new ScanIteration<>(Long.valueOf(result.getCursor()), result.getResult());
+ return new ScanIteration<>(CursorId.of(result.getCursor()), result.getResult());
}
protected void doClose() {
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java
index 6da69c5f1a..c3ecbe8255 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
index 815f3aea87..889e87b102 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
index b4bcc5763e..46a9b49668 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
index a19247a8d1..749e198bcb 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -35,6 +35,7 @@
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.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -561,24 +562,25 @@ public Long zUnionStore(byte[] destKey, byte[]... sets) {
@Override
public Cursor zScan(byte[] key, ScanOptions options) {
- return zScan(key, 0L, options);
+ return zScan(key, CursorId.initial(), options);
}
+
/**
- * @since 1.4
* @param key
* @param cursorId
* @param options
* @return
+ * @since 3.2.1
*/
- public Cursor zScan(byte[] key, Long cursorId, ScanOptions options) {
+ public Cursor zScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor(key, cursorId, options) {
@Override
- protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (isQueueing() || isPipelined()) {
throw new InvalidDataAccessApiUsageException("'ZSCAN' cannot be called in pipeline / transaction mode");
@@ -588,7 +590,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions opt
ScanResult result = connection.getJedis().zscan(key,
JedisConverters.toBytes(cursorId), params);
- return new ScanIteration<>(Long.valueOf(result.getCursor()),
+ return new ScanIteration<>(CursorId.of(result.getCursor()),
JedisConverters.tuplesToTuples().convert(result.getResult()));
}
diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java
index ccb75534ce..60d16a1f4a 100644
--- a/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/jedis/StreamConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
index c30d0a9351..0b2061f5a7 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/ClusterConnectionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java
index 08d15e2851..c166000bca 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettuceClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java
index 80eea51135..fac5f8ec20 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/DefaultLettucePoolingClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java
index 57cf53ac85..d76cc2aee1 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceByteBufferPubSubListenerWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java
index 8582eb5d81..6372226843 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
index 5d2f53618f..3756e9f8b4 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java
index 7c3ad807e7..d220ed3cb4 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java
index 52159887f6..29f36d29e7 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java
index dac2765f41..d8215c338f 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java
index 3be1478b8f..ae3d3b2e49 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -18,11 +18,8 @@
import io.lettuce.core.KeyScanCursor;
import io.lettuce.core.ScanArgs;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.concurrent.ThreadLocalRandom;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.ClusterSlotHashUtil;
@@ -50,47 +47,6 @@ class LettuceClusterKeyCommands extends LettuceKeyCommands {
this.connection = connection;
}
- @Override
- public byte[] randomKey() {
-
- List nodes = connection.clusterGetNodes();
- Set inspectedNodes = new HashSet<>(nodes.size());
-
- do {
-
- RedisClusterNode node = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size()));
-
- while (inspectedNodes.contains(node)) {
- node = nodes.get(ThreadLocalRandom.current().nextInt(nodes.size()));
- }
- inspectedNodes.add(node);
- byte[] key = randomKey(node);
-
- if (key != null && key.length > 0) {
- return key;
- }
- } while (nodes.size() != inspectedNodes.size());
-
- return null;
- }
-
- @Override
- public Set keys(byte[] pattern) {
-
- Assert.notNull(pattern, "Pattern must not be null");
-
- Collection> keysPerNode = connection.getClusterCommandExecutor()
- .executeCommandOnAllNodes((LettuceClusterCommandCallback>) connection -> connection.keys(pattern))
- .resultsAsList();
-
- Set keys = new HashSet<>();
-
- for (List keySet : keysPerNode) {
- keys.addAll(keySet);
- }
- return keys;
- }
-
@Override
public void rename(byte[] oldKey, byte[] newKey) {
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java
index 1b4d43c1ba..f7905764e5 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java
index b014afc8dd..6d2e66cda0 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -18,7 +18,6 @@
import io.lettuce.core.api.sync.RedisServerCommands;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -34,7 +33,6 @@
import org.springframework.data.redis.connection.lettuce.LettuceClusterConnection.LettuceClusterCommandCallback;
import org.springframework.data.redis.core.types.RedisClientInfo;
import org.springframework.util.Assert;
-import org.springframework.util.CollectionUtils;
/**
* @author Mark Paluch
@@ -71,37 +69,11 @@ public void save(RedisClusterNode node) {
executeCommandOnSingleNode(RedisServerCommands::save, node);
}
- @Override
- public Long dbSize() {
-
- Collection dbSizes = executeCommandOnAllNodes(RedisServerCommands::dbsize).resultsAsList();
-
- if (CollectionUtils.isEmpty(dbSizes)) {
- return 0L;
- }
-
- Long size = 0L;
- for (Long value : dbSizes) {
- size += value;
- }
- return size;
- }
-
@Override
public Long dbSize(RedisClusterNode node) {
return executeCommandOnSingleNode(RedisServerCommands::dbsize, node).getValue();
}
- @Override
- public void flushDb() {
- executeCommandOnAllNodes(RedisServerCommands::flushdb);
- }
-
- @Override
- public void flushDb(FlushOption option) {
- executeCommandOnAllNodes(it -> it.flushdb(LettuceConverters.toFlushMode(option)));
- }
-
@Override
public void flushDb(RedisClusterNode node) {
executeCommandOnSingleNode(RedisServerCommands::flushdb, node);
@@ -112,16 +84,6 @@ public void flushDb(RedisClusterNode node, FlushOption option) {
executeCommandOnSingleNode(it -> it.flushdb(LettuceConverters.toFlushMode(option)), node);
}
- @Override
- public void flushAll() {
- executeCommandOnAllNodes(RedisServerCommands::flushall);
- }
-
- @Override
- public void flushAll(FlushOption option) {
- executeCommandOnAllNodes(it -> it.flushall(LettuceConverters.toFlushMode(option)));
- }
-
@Override
public void flushAll(RedisClusterNode node) {
executeCommandOnSingleNode(RedisServerCommands::flushall, node);
@@ -220,7 +182,7 @@ public Properties getConfig(RedisClusterNode node, String pattern) {
public void setConfig(String param, String value) {
Assert.hasText(param, "Parameter must not be null or empty");
- Assert.hasText(value, "Value must not be null or empty");
+ Assert.notNull(value, "Value must not be null");
executeCommandOnAllNodes(client -> client.configSet(param, value));
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java
index d8f7a99f37..3a346141c2 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java
index 315bef842d..4b6ae60f04 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -15,11 +15,6 @@
*/
package org.springframework.data.redis.connection.lettuce;
-import java.util.Map;
-
-import org.springframework.data.redis.connection.ClusterSlotHashUtil;
-import org.springframework.util.Assert;
-
/**
* @author Christoph Strobl
* @author Mark Paluch
@@ -31,21 +26,4 @@ class LettuceClusterStringCommands extends LettuceStringCommands {
super(connection);
}
- @Override
- public Boolean mSetNX(Map tuples) {
-
- Assert.notNull(tuples, "Tuples must not be null");
-
- if (ClusterSlotHashUtil.isSameSlotForAllKeys(tuples.keySet().toArray(new byte[tuples.keySet().size()][]))) {
- return super.mSetNX(tuples);
- }
-
- boolean result = true;
- for (Map.Entry entry : tuples.entrySet()) {
- if (!setNX(entry.getKey(), entry.getValue()) && result) {
- result = false;
- }
- }
- return result;
- }
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java
index 3f5d520150..5176bf68e1 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterTopologyProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java
index 0148fe3da6..fa80eeda87 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java
index 01ba6a780c..c3ecbde730 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
@@ -49,7 +49,9 @@
import java.util.List;
import java.util.Map;
import java.util.Queue;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
@@ -57,6 +59,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.BeanUtils;
import org.springframework.core.convert.converter.Converter;
import org.springframework.dao.DataAccessException;
@@ -70,6 +73,7 @@
import org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider.TargetAware;
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceResultBuilder;
import org.springframework.data.redis.connection.lettuce.LettuceResult.LettuceStatusResult;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.RedisCommand;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -100,8 +104,8 @@
*/
public class LettuceConnection extends AbstractRedisConnection {
- private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION =
- new FallbackExceptionTranslationStrategy(LettuceExceptionConverter.INSTANCE);
+ private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new FallbackExceptionTranslationStrategy(
+ LettuceExceptionConverter.INSTANCE);
static final RedisCodec CODEC = ByteArrayCodec.INSTANCE;
@@ -187,8 +191,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share
/**
* Creates a new {@link LettuceConnection}.
*
- * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s.
- * Should not be used for transactions or blocking operations.
+ * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be
+ * used for transactions or blocking operations.
* @param timeout The connection timeout (in milliseconds)
* @param client The {@link RedisClient} to use when making pub/sub connections.
* @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection.
@@ -207,8 +211,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share
/**
* Creates a new {@link LettuceConnection}.
*
- * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s.
- * Should not be used for transactions or blocking operations.
+ * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be
+ * used for transactions or blocking operations.
* @param connectionProvider connection provider to obtain and release native connections.
* @param timeout The connection timeout (in milliseconds)
* @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection.
@@ -223,8 +227,8 @@ public LettuceConnection(@Nullable StatefulRedisConnection share
/**
* Creates a new {@link LettuceConnection}.
*
- * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s.
- * Should not be used for transactions or blocking operations.
+ * @param sharedConnection A native connection that is shared with other {@link LettuceConnection}s. Should not be
+ * used for transactions or blocking operations.
* @param connectionProvider connection provider to obtain and release native connections.
* @param timeout The connection timeout (in milliseconds)
* @param defaultDbIndex The db index to use along with {@link RedisClient} when establishing a dedicated connection.
@@ -451,24 +455,19 @@ private LettuceInvoker doInvoke(RedisClusterAsyncCommands connec
LettuceResult newLettuceResult(Future resultHolder, Converter converter) {
- return LettuceResultBuilder.forResponse(resultHolder)
- .mappedWith(converter)
- .convertPipelineAndTxResults(this.convertPipelineAndTxResults)
- .build();
+ return LettuceResultBuilder. forResponse(resultHolder).mappedWith(converter)
+ .convertPipelineAndTxResults(this.convertPipelineAndTxResults).build();
}
LettuceResult newLettuceResult(Future resultHolder, Converter converter,
Supplier defaultValue) {
- return LettuceResultBuilder.forResponse(resultHolder)
- .mappedWith(converter)
- .convertPipelineAndTxResults(this.convertPipelineAndTxResults)
- .defaultNullTo(defaultValue)
- .build();
+ return LettuceResultBuilder. forResponse(resultHolder).mappedWith(converter)
+ .convertPipelineAndTxResults(this.convertPipelineAndTxResults).defaultNullTo(defaultValue).build();
}
LettuceResult newLettuceStatusResult(Future resultHolder) {
- return LettuceResultBuilder.forResponse(resultHolder).buildStatusResult();
+ return LettuceResultBuilder. forResponse(resultHolder).buildStatusResult();
}
void pipeline(LettuceResult, ?> result) {
@@ -581,7 +580,7 @@ public List closePipeline() {
pipeliningFlushState = null;
isPipelined = false;
- List> futures = new ArrayList<>(ppline.size());
+ List> futures = new ArrayList<>(ppline.size());
for (LettuceResult, ?> result : ppline) {
futures.add(result.getResultHolder());
@@ -598,10 +597,24 @@ public List closePipeline() {
if (done) {
for (LettuceResult, ?> result : ppline) {
- if (result.getResultHolder().getOutput().hasError()) {
+ CompletableFuture> resultHolder = result.getResultHolder();
+ if (resultHolder.isCompletedExceptionally()) {
+
+ String message;
+ if (resultHolder instanceof io.lettuce.core.protocol.RedisCommand, ?, ?> rc) {
+ message = rc.getOutput().getError();
+ } else {
+ try {
+ resultHolder.get();
+ message = "";
+ } catch (InterruptedException ignore) {
+ message = "";
+ } catch (ExecutionException e) {
+ message = e.getCause().getMessage();
+ }
+ }
- Exception exception = new InvalidDataAccessApiUsageException(result.getResultHolder()
- .getOutput().getError());
+ Exception exception = new InvalidDataAccessApiUsageException(message);
// remember only the first error
if (problem == null) {
@@ -682,8 +695,8 @@ public List exec() {
LettuceTransactionResultConverter resultConverter = new LettuceTransactionResultConverter(
new LinkedList<>(txResults), exceptionConverter);
- pipeline(newLettuceResult(exec, source ->
- resultConverter.convert(LettuceConverters.transactionResultUnwrapper().convert(source))));
+ pipeline(newLettuceResult(exec,
+ source -> resultConverter.convert(LettuceConverters.transactionResultUnwrapper().convert(source))));
return null;
}
@@ -835,8 +848,7 @@ T failsafeReadScanValues(List> source, @SuppressWarnings("rawtypes") @Null
try {
return (T) (converter != null ? converter.convert(source) : source);
- } catch (IndexOutOfBoundsException ignore) {
- }
+ } catch (IndexOutOfBoundsException ignore) {}
return null;
}
@@ -1060,8 +1072,8 @@ private void potentiallySelectDatabase(int dbIndex) {
}
}
- io.lettuce.core.ScanCursor getScanCursor(long cursorId) {
- return io.lettuce.core.ScanCursor.of(Long.toString(cursorId));
+ io.lettuce.core.ScanCursor getScanCursor(CursorId cursorId) {
+ return io.lettuce.core.ScanCursor.of(cursorId.getCursorId());
}
private void validateCommandIfRunningInTransactionMode(ProtocolKeyword cmd, byte[]... args) {
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
index f3c818a510..c406faaa1e 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
@@ -15,8 +15,7 @@
*/
package org.springframework.data.redis.connection.lettuce;
-import static org.springframework.data.redis.connection.lettuce.LettuceConnection.CODEC;
-import static org.springframework.data.redis.connection.lettuce.LettuceConnection.PipeliningFlushPolicy;
+import static org.springframework.data.redis.connection.lettuce.LettuceConnection.*;
import io.lettuce.core.AbstractRedisClient;
import io.lettuce.core.ClientOptions;
@@ -50,6 +49,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.SmartLifecycle;
@@ -59,23 +59,10 @@
import org.springframework.data.redis.ExceptionTranslationStrategy;
import org.springframework.data.redis.PassThroughExceptionTranslationStrategy;
import org.springframework.data.redis.RedisConnectionFailureException;
-import org.springframework.data.redis.connection.ClusterCommandExecutor;
-import org.springframework.data.redis.connection.ClusterTopologyProvider;
-import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
-import org.springframework.data.redis.connection.RedisClusterConfiguration;
-import org.springframework.data.redis.connection.RedisClusterConnection;
-import org.springframework.data.redis.connection.RedisConfiguration;
+import org.springframework.data.redis.connection.*;
import org.springframework.data.redis.connection.RedisConfiguration.ClusterConfiguration;
import org.springframework.data.redis.connection.RedisConfiguration.WithDatabaseIndex;
import org.springframework.data.redis.connection.RedisConfiguration.WithPassword;
-import org.springframework.data.redis.connection.RedisConnection;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.connection.RedisPassword;
-import org.springframework.data.redis.connection.RedisSentinelConfiguration;
-import org.springframework.data.redis.connection.RedisSentinelConnection;
-import org.springframework.data.redis.connection.RedisSocketConfiguration;
-import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
-import org.springframework.data.redis.connection.RedisStaticMasterReplicaConfiguration;
import org.springframework.data.redis.util.RedisAssertions;
import org.springframework.data.util.Optionals;
import org.springframework.lang.Nullable;
@@ -85,7 +72,8 @@
import org.springframework.util.StringUtils;
/**
- * {@link RedisConnectionFactory Connection factory} creating Lettuce -based connections.
+ * {@link RedisConnectionFactory Connection factory} creating Lettuce -based
+ * connections.
*
* This factory creates a new {@link LettuceConnection} on each call to {@link #getConnection()}. While multiple
* {@link LettuceConnection}s share a single thread-safe native connection by default, {@link LettuceConnection} and its
@@ -112,8 +100,9 @@
* This connection factory implements {@link InitializingBean} and {@link SmartLifecycle} for flexible lifecycle
* control. It must be {@link #afterPropertiesSet() initialized} and {@link #start() started} before you can obtain a
* connection. {@link #afterPropertiesSet() Initialization} {@link SmartLifecycle#start() starts} this bean
- * {@link #isAutoStartup() by default}. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start() restart}
- * this connection factory if needed.
+ * {@link #isEarlyStartup() early} by default. You can {@link SmartLifecycle#stop()} and {@link SmartLifecycle#start()
+ * restart} this connection factory if needed. Disabling {@link #isEarlyStartup() early startup} leaves lifecycle
+ * management to the container refresh if {@link #isAutoStartup() auto-startup} is enabled.
*
* @author Costin Leau
* @author Jennifer Hickey
@@ -133,13 +122,14 @@ public class LettuceConnectionFactory implements RedisConnectionFactory, Reactiv
private static final ExceptionTranslationStrategy EXCEPTION_TRANSLATION = new PassThroughExceptionTranslationStrategy(
LettuceExceptionConverter.INSTANCE);
+ private int phase = 0; // in between min and max values
+ private boolean autoStartup = true;
+ private boolean earlyStartup = true;
private boolean convertPipelineAndTxResults = true;
private boolean eagerInitialization = false;
+
private boolean shareNativeConnection = true;
private boolean validateConnection = false;
-
- private int phase = 0; // in between min and max values
-
private @Nullable AbstractRedisClient client;
private final AtomicReference state = new AtomicReference<>(State.CREATED);
@@ -568,12 +558,13 @@ public void setShareNativeConnection(boolean shareNativeConnection) {
/**
* Indicates {@link #setShareNativeConnection(boolean) shared connections} should be eagerly initialized. Eager
- * initialization requires a running Redis instance during application startup to allow early validation of connection
- * factory configuration. Eager initialization also prevents blocking connect while using reactive API and is
- * recommended for reactive API usage.
+ * initialization requires a running Redis instance during {@link #start() startup} to allow early validation of
+ * connection factory configuration. Eager initialization also prevents blocking connect while using reactive API and
+ * is recommended for reactive API usage.
*
- * @return {@link true} if the shared connection is initialized upon {@link #afterPropertiesSet()}.
+ * @return {@link true} if the shared connection is initialized upon {@link #start()}.
* @since 2.2
+ * @see #start()
*/
public boolean getEagerInitialization() {
return this.eagerInitialization;
@@ -602,8 +593,12 @@ public int getDatabase() {
/**
* Sets the index of the database used by this connection factory. Default is 0.
*
- * @param index database index
+ * @param index database index.
+ * @deprecated since 3.2, configure the database index using {@link RedisStandaloneConfiguration},
+ * {@link RedisSocketConfiguration}, {@link RedisSentinelConfiguration}, or
+ * {@link RedisStaticMasterReplicaConfiguration}.
*/
+ @Deprecated
public void setDatabase(int index) {
Assert.isTrue(index >= 0, "invalid DB index (a positive index required)");
@@ -672,7 +667,7 @@ public AbstractRedisClient getNativeClient() {
public AbstractRedisClient getRequiredNativeClient() {
return RedisAssertions.requireState(getNativeClient(),
- "Client not yet initialized; Did you forget to call initialize the bean");
+ "Client not yet initialized; Did you forget to call initialize the bean");
}
@Nullable
@@ -803,6 +798,70 @@ public RedisClusterConfiguration getClusterConfiguration() {
return isClusterAware() ? (RedisClusterConfiguration) this.configuration : null;
}
+ @Override
+ public int getPhase() {
+ return this.phase;
+ }
+
+ /**
+ * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}.
+ *
+ * @since 3.2
+ * @see SmartLifecycle#getPhase()
+ */
+ public void setPhase(int phase) {
+ this.phase = phase;
+ }
+
+ /**
+ * @since 3.3
+ */
+ @Override
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+
+ /**
+ * Configure if this Lifecycle connection factory should get started automatically by the container at the time that
+ * the containing ApplicationContext gets refreshed.
+ *
+ * This connection factory defaults to early auto-startup during {@link #afterPropertiesSet()} and can potentially
+ * create Redis connections early on in the lifecycle. See {@link #setEarlyStartup(boolean)} for delaying connection
+ * creation to the ApplicationContext refresh if auto-startup is enabled.
+ *
+ * @param autoStartup {@literal true} to automatically {@link #start()} the connection factory; {@literal false}
+ * otherwise.
+ * @since 3.3
+ * @see #setEarlyStartup(boolean)
+ * @see #start()
+ */
+ public void setAutoStartup(boolean autoStartup) {
+ this.autoStartup = autoStartup;
+ }
+
+ /**
+ * @return whether to {@link #start()} the component during {@link #afterPropertiesSet()}.
+ * @since 3.3
+ */
+ public boolean isEarlyStartup() {
+ return this.earlyStartup;
+ }
+
+ /**
+ * Configure if this InitializingBean's component Lifecycle should get started early by {@link #afterPropertiesSet()}
+ * at the time that the bean is initialized. The component defaults to auto-startup.
+ *
+ * This method is related to {@link #setAutoStartup(boolean) auto-startup} and can be used to delay Redis client
+ * startup until the ApplicationContext refresh. Disabling early startup does not disable auto-startup.
+ *
+ * @param earlyStartup {@literal true} to early {@link #start()} the component; {@literal false} otherwise.
+ * @since 3.3
+ * @see #setAutoStartup(boolean)
+ */
+ public void setEarlyStartup(boolean earlyStartup) {
+ this.earlyStartup = earlyStartup;
+ }
+
/**
* Specifies if pipelined results should be converted to the expected data type. If {@code false}, results of
* {@link LettuceConnection#closePipeline()} and {LettuceConnection#exec()} will be of the type returned by the
@@ -932,21 +991,6 @@ public void stop() {
state.set(State.STOPPED);
}
- @Override
- public int getPhase() {
- return this.phase;
- }
-
- /**
- * Specify the lifecycle phase for pausing and resuming this executor. The default is {@code 0}.
- *
- * @since 3.2
- * @see SmartLifecycle#getPhase()
- */
- public void setPhase(int phase) {
- this.phase = phase;
- }
-
@Override
public boolean isRunning() {
return State.STARTED.equals(this.state.get());
@@ -955,7 +999,7 @@ public boolean isRunning() {
@Override
public void afterPropertiesSet() {
- if (isAutoStartup()) {
+ if (isEarlyStartup()) {
start();
}
}
@@ -1002,8 +1046,8 @@ public RedisConnection getConnection() {
return getClusterConnection();
}
- LettuceConnection connection =
- doCreateLettuceConnection(getSharedConnection(), this.connectionProvider, getTimeout(), getDatabase());
+ LettuceConnection connection = doCreateLettuceConnection(getSharedConnection(), this.connectionProvider,
+ getTimeout(), getDatabase());
connection.setConvertPipelineAndTxResults(this.convertPipelineAndTxResults);
@@ -1141,7 +1185,7 @@ public void resetConnection() {
doInLock(() -> {
Optionals.toStream(Optional.ofNullable(this.connection), Optional.ofNullable(this.reactiveConnection))
- .forEach(SharedConnection::resetConnection);
+ .forEach(SharedConnection::resetConnection);
this.connection = null;
this.reactiveConnection = null;
@@ -1251,7 +1295,7 @@ protected LettuceConnectionProvider doCreateConnectionProvider(AbstractRedisClie
return isStaticMasterReplicaAware() ? createStaticMasterReplicaConnectionProvider((RedisClient) client, codec)
: isClusterAware() ? createClusterConnectionProvider((RedisClusterClient) client, codec)
- : createStandaloneConnectionProvider((RedisClient) client, codec);
+ : createStandaloneConnectionProvider((RedisClient) client, codec);
}
@SuppressWarnings("all")
@@ -1278,8 +1322,7 @@ protected AbstractRedisClient createClient() {
return isStaticMasterReplicaAware() ? createStaticMasterReplicaClient()
: isRedisSentinelAware() ? createSentinelClient()
- : isClusterAware() ? createClusterClient()
- : createBasicClient();
+ : isClusterAware() ? createClusterClient() : createBasicClient();
}
private RedisClient createStaticMasterReplicaClient() {
@@ -1345,8 +1388,7 @@ private RedisClusterClient createClusterClient() {
ClusterConfiguration clusterConfiguration = (ClusterConfiguration) this.configuration;
clusterConfiguration.getClusterNodes().stream()
- .map(node -> createRedisURIAndApplySettings(node.getHost(), node.getPort()))
- .forEach(initialUris::add);
+ .map(node -> createRedisURIAndApplySettings(node.getHost(), node.getPort())).forEach(initialUris::add);
RedisClusterClient clusterClient = this.clientConfiguration.getClientResources()
.map(clientResources -> RedisClusterClient.create(clientResources, initialUris))
@@ -1399,8 +1441,8 @@ private void assertStarted() {
switch (current) {
case CREATED, STOPPED -> throw new IllegalStateException(
String.format("LettuceConnectionFactory has been %s. Use start() to initialize it", current));
- case DESTROYED -> throw new IllegalStateException(
- "LettuceConnectionFactory was destroyed and cannot be used anymore");
+ case DESTROYED ->
+ throw new IllegalStateException("LettuceConnectionFactory was destroyed and cannot be used anymore");
default -> throw new IllegalStateException(String.format("LettuceConnectionFactory is %s", current));
}
}
@@ -1431,9 +1473,7 @@ private RedisURI createRedisURIAndApplySettings(String host, int port) {
private RedisURI createRedisSocketURIAndApplySettings(String socketPath) {
return applyAuthentication(RedisURI.Builder.socket(socketPath))
- .withTimeout(this.clientConfiguration.getCommandTimeout())
- .withDatabase(getDatabase())
- .build();
+ .withTimeout(this.clientConfiguration.getCommandTimeout()).withDatabase(getDatabase()).build();
}
private RedisURI.Builder applyAuthentication(RedisURI.Builder builder) {
@@ -1467,7 +1507,10 @@ private long getClientTimeout() {
}
private void doInLock(Runnable runnable) {
- doInLock(() -> { runnable.run(); return null; });
+ doInLock(() -> {
+ runnable.run();
+ return null;
+ });
}
private T doInLock(Supplier supplier) {
@@ -1476,8 +1519,7 @@ private T doInLock(Supplier supplier) {
try {
return supplier.get();
- }
- finally {
+ } finally {
this.lock.unlock();
}
}
@@ -1539,12 +1581,12 @@ private StatefulConnection getNativeConnection() {
}
/**
- * Null-safe operation to evaluate whether the given {@link StatefulConnection connetion}
- * is {@link StatefulConnection#isOpen() open}.
+ * Null-safe operation to evaluate whether the given {@link StatefulConnection connetion} is
+ * {@link StatefulConnection#isOpen() open}.
*
* @param connection {@link StatefulConnection} to evaluate.
- * @return a boolean value indicating whether the given {@link StatefulConnection} is not {@literal null}
- * and is {@link StatefulConnection#isOpen() open}.
+ * @return a boolean value indicating whether the given {@link StatefulConnection} is not {@literal null} and is
+ * {@link StatefulConnection#isOpen() open}.
* @see io.lettuce.core.api.StatefulConnection#isOpen()
*/
private boolean isOpen(@Nullable StatefulConnection, ?> connection) {
@@ -1554,8 +1596,8 @@ private boolean isOpen(@Nullable StatefulConnection, ?> connection) {
/**
* Validate the {@link StatefulConnection connection}.
*
- * {@link StatefulConnection Connections} are considered valid if they can send/receive ping packets.
- * Invalid {@link StatefulConnection connections} will be closed and the connection state will be reset.
+ * {@link StatefulConnection Connections} are considered valid if they can send/receive ping packets. Invalid
+ * {@link StatefulConnection connections} will be closed and the connection state will be reset.
*/
void validateConnection() {
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java
index 6334d4db33..cdfcf5c980 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
index 8990995599..d4aa2d9cc8 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java
index f6bfa7a1cd..1b0a27441c 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceExceptionConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java
index 6adaa5f4ab..f1f56e1b5c 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceFutureUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java
index cc94010393..f0ff6e2715 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java
index cf1c652700..5125a82fb6 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -29,6 +29,7 @@
import org.springframework.data.redis.connection.RedisHashCommands;
import org.springframework.data.redis.connection.convert.Converters;
import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -204,24 +205,25 @@ public List hVals(byte[] key) {
@Override
public Cursor> hScan(byte[] key, ScanOptions options) {
- return hScan(key, 0, options);
+ return hScan(key, CursorId.initial(), options);
}
+
/**
- * @since 1.4
* @param key
* @param cursorId
* @param options
* @return
+ * @since 1.4
*/
- public Cursor> hScan(byte[] key, long cursorId, ScanOptions options) {
+ public Cursor> hScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor>(key, cursorId, options) {
@Override
- protected ScanIteration> doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration> doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (connection.isQueueing() || connection.isPipelined()) {
throw new InvalidDataAccessApiUsageException("'HSCAN' cannot be called in pipeline / transaction mode");
@@ -235,7 +237,7 @@ protected ScanIteration> doScan(byte[] key, long cursorId,
String nextCursorId = mapScanCursor.getCursor();
Map values = mapScanCursor.getMap();
- return new ScanIteration<>(Long.valueOf(nextCursorId), values.entrySet());
+ return new ScanIteration<>(CursorId.of(nextCursorId), values.entrySet());
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java
index a260137cf6..12fbbd5be2 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java
index 6c4b640afb..7661db4a73 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceInvoker.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
index c4d5e88fbf..415da2ccaa 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java
index 8e0bcb1f20..cc1be60431 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java
index 458b64da3b..2c4b021bbd 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceMessageListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java
index 246a02d41c..c9fa6c242e 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingClientConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java
index c6e321b31d..d82e88c3a0 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettucePoolingConnectionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java
index d4be69a17c..c797927296 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java
index 959fa54c3d..9b5969d88d 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java
index 634ace5004..999207aa75 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java
index 5b741fdd42..87c34658f8 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java
index 160701811f..2001abdf17 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java
index fddd98bf7d..d25f6c1c95 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterNumberCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java
index 068c04551c..e4907f90ce 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java
index 88559991de..fca3ee62de 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
index 3fdea2cf7e..be5790956f 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java
index cd5435b388..9de831682a 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java
index befc3360b8..b0d4e6a1b8 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java
index bd559c751a..ccd8de9354 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java
index 0d04d66168..4502f5eb07 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java
index 9227fa0b86..0837489840 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java
index 1994cfccab..f4cd6e9186 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java
index 97fc100cea..a7df677064 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
index 68682a78f6..2721877f4c 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java
index 035ba478e4..fd4b0de4f6 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java
index e81bcea995..7e25074679 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactivePubSubCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
index 4a3bb81d07..a688e94060 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisClusterConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java
index 281144d2d1..b99c098096 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java
index 497cdf21cc..c6d5686486 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java
index 15c203b894..f3aa9bd2af 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -130,7 +130,7 @@ public Mono getConfig(String pattern) {
public Mono setConfig(String param, String value) {
Assert.hasText(param, "Parameter must not be null or empty");
- Assert.hasText(value, "Value must not be null or empty");
+ Assert.notNull(value, "Value must not be null");
return connection.execute(c -> c.configSet(param, value)).next();
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java
index 3003e1d4e1..8fd0d4f403 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
index 6914259b18..e22b298146 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
index 77021a0d03..5008c5e68d 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java
index c259e89929..9098c14c84 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java
index 73b3f27ed6..d11f6229be 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java
index 665431c3a1..4c0a825c85 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -15,8 +15,7 @@
*/
package org.springframework.data.redis.connection.lettuce;
-import io.lettuce.core.protocol.RedisCommand;
-
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.function.Supplier;
@@ -34,7 +33,7 @@
* @since 2.1
*/
@SuppressWarnings("rawtypes")
-class LettuceResult extends FutureResult> {
+class LettuceResult extends FutureResult> {
private final boolean convertPipelineAndTxResults;
@@ -51,7 +50,7 @@ class LettuceResult extends FutureResult> {
LettuceResult(Future resultHolder, Supplier defaultReturnValue, boolean convertPipelineAndTxResults,
@Nullable Converter converter) {
- super((RedisCommand) resultHolder, converter, defaultReturnValue);
+ super((CompletableFuture) resultHolder, converter, defaultReturnValue);
this.convertPipelineAndTxResults = convertPipelineAndTxResults;
}
@@ -59,7 +58,7 @@ class LettuceResult extends FutureResult> {
@Override
@SuppressWarnings("unchecked")
public T get() {
- return (T) getResultHolder().getOutput().get();
+ return (T) getResultHolder().join();
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java
index e5276b2fb7..6f5ed1a945 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScanCursor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -46,9 +46,9 @@ abstract class LettuceScanCursor extends ScanCursor {
}
@Override
- protected ScanIteration doScan(long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(CursorId cursorId, ScanOptions options) {
- if (state == null && cursorId == 0) {
+ if (state == null && cursorId.isInitial()) {
return scanAndProcessState(io.lettuce.core.ScanCursor.INITIAL, options);
}
@@ -64,7 +64,7 @@ protected ScanIteration doScan(long cursorId, ScanOptions options) {
}
@Override
- protected boolean isFinished(long cursorId) {
+ protected boolean isFinished(CursorId cursorId) {
return state != null && isMatchingCursor(cursorId) ? state.isFinished() : super.isFinished(cursorId);
}
@@ -76,8 +76,8 @@ private ScanIteration scanAndProcessState(io.lettuce.core.ScanCursor scanCurs
return iteration;
}
- private boolean isMatchingCursor(long cursorId) {
- return state != null && state.getCursor().equals(Long.toString(cursorId));
+ private boolean isMatchingCursor(CursorId cursorId) {
+ return state != null && state.getCursor().equals(cursorId.getCursorId());
}
/**
@@ -101,7 +101,7 @@ static class LettuceScanIteration extends ScanIteration {
LettuceScanIteration(io.lettuce.core.ScanCursor cursor, Collection items) {
- super(Long.parseLong(cursor.getCursor()), items);
+ super(CursorId.of(cursor.getCursor()), items);
this.cursor = cursor;
}
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java
index e41368d501..de38a44747 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceScriptingCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java
index d512e6ed77..79bf304a91 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSentinelConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java
index 1acb7dff1c..54a1dcfd6d 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceServerCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -145,7 +145,7 @@ public Properties getConfig(String pattern) {
public void setConfig(String param, String value) {
Assert.hasText(param, "Parameter must not be null or empty");
- Assert.hasText(value, "Value must not be null or empty");
+ Assert.notNull(value, "Value must not be null");
connection.invokeStatus().just(RedisServerAsyncCommands::configSet, param, value);
}
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java
index 4629be67c8..3e210bdedd 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -27,6 +27,7 @@
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.RedisSetCommands;
import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -201,24 +202,24 @@ public Long sUnionStore(byte[] destKey, byte[]... keys) {
@Override
public Cursor sScan(byte[] key, ScanOptions options) {
- return sScan(key, 0, options);
+ return sScan(key, CursorId.initial(), options);
}
/**
- * @since 1.4
* @param key
* @param cursorId
* @param options
* @return
+ * @since 1.4
*/
- public Cursor sScan(byte[] key, long cursorId, ScanOptions options) {
+ public Cursor sScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor(key, cursorId, options) {
@Override
- protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (connection.isQueueing() || connection.isPipelined()) {
throw new InvalidDataAccessApiUsageException("'SSCAN' cannot be called in pipeline / transaction mode");
@@ -232,7 +233,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions op
String nextCursorId = valueScanCursor.getCursor();
List values = connection.failsafeReadScanValues(valueScanCursor.getValues(), null);
- return new ScanIteration<>(Long.valueOf(nextCursorId), values);
+ return new ScanIteration<>(CursorId.of(nextCursorId), values);
}
protected void doClose() {
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
index 4ef6fc80fc..7f15f68e8e 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStreamCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
index f6c552f042..1397fc9ce7 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceStringCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java
index e007c6d63b..72acfef38f 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java
index cc3e63601d..9ebccac7b9 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceZSetCommands.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -35,6 +35,7 @@
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.Cursor.CursorId;
import org.springframework.data.redis.core.KeyBoundCursor;
import org.springframework.data.redis.core.ScanIteration;
import org.springframework.data.redis.core.ScanOptions;
@@ -530,20 +531,20 @@ public Long zUnionStore(byte[] destKey, byte[]... sets) {
@Override
public Cursor zScan(byte[] key, ScanOptions options) {
- return zScan(key, 0L, options);
+ return zScan(key, CursorId.initial(), options);
}
/**
* @since 1.4
*/
- public Cursor zScan(byte[] key, long cursorId, ScanOptions options) {
+ public Cursor zScan(byte[] key, CursorId cursorId, ScanOptions options) {
Assert.notNull(key, "Key must not be null");
return new KeyBoundCursor(key, cursorId, options) {
@Override
- protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions options) {
+ protected ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options) {
if (connection.isQueueing() || connection.isPipelined()) {
throw new InvalidDataAccessApiUsageException("'ZSCAN' cannot be called in pipeline / transaction mode");
@@ -559,7 +560,7 @@ protected ScanIteration doScan(byte[] key, long cursorId, ScanOptions opt
List> result = scoredValueScanCursor.getValues();
List values = connection.failsafeReadScanValues(result, LettuceConverters.scoredValuesToTupleList());
- return new ScanIteration<>(Long.valueOf(nextCursorId), values);
+ return new ScanIteration<>(CursorId.of(nextCursorId), values);
}
@Override
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java
index d306860054..7777c165d9 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RangeConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java
index 4471e9d415..637999d1d9 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisClientProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java
index f1e2924103..e34b8f5757 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/RedisCredentialsProviderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
index 841e378d6f..15bcd3d1bb 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StandaloneConnectionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java
index 51f3d7958b..ca3d4337b0 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StaticMasterReplicaConnectionProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java b/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java
index 8d1fe8b153..a243a44748 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/StreamConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java b/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java
index 0486c7315e..fc9d3ab70a 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/aot/LettuceRuntimeHints.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java
index 4e44472362..fa662181f5 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/DefaultLettuceObservationConvention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java
index 00230bb469..e1a77d3e7b 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java
index d54f73b9b8..92c1e0ee0a 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/LettuceObservationConvention.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java
index 72aa9fdc96..010c5eb155 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/MicrometerTracingAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java
index 05e87ff12f..fb57b0fd82 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/RedisObservation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013-2023 the original author or authors.
+ * Copyright 2013-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java
index 419fe4bff6..ecc6b26fe1 100644
--- a/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java
+++ b/src/main/java/org/springframework/data/redis/connection/lettuce/observability/SocketAddressEndpoint.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java
index abceca8d66..990dc0ffc6 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/ByteBufferRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java
index df928f2c78..f2d97ca812 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/ByteRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java b/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java
index 00add551b2..6219266652 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/Consumer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java
index d0b6299ceb..731af14240 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/MapRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java
index d00a87820a..62c42775a6 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/ObjectRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java
index 80a281b1f2..7358645534 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessage.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java
index 02ca7edb61..80a3e146db 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessages.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java
index e6dd8f9395..5716b2f34f 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/PendingMessagesSummary.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java b/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java
index 4ea87d361a..7efec2110c 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/ReadOffset.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/Record.java b/src/main/java/org/springframework/data/redis/connection/stream/Record.java
index d17c3f142d..4c34d5ce87 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/Record.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/Record.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java b/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java
index 62be1fbadc..5791a116d4 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/RecordId.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java
index a48d767da6..c822fcea47 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2023 the original author or authors.
+ * Copyright 2020-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java
index f4c1b4e8a1..5ceb927972 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamOffset.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java
index 4ea53c461b..45c456c0bc 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamReadOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
index 47536fc5ac..bf9a34eec3 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamRecords.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java b/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java
index ba6818ce76..6558727a0b 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StreamSerialization.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java b/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java
index 2fd460a205..b1b8bce931 100644
--- a/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java
+++ b/src/main/java/org/springframework/data/redis/connection/stream/StringRecord.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java
index 442b4c6254..d04adc7854 100644
--- a/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java
+++ b/src/main/java/org/springframework/data/redis/connection/util/AbstractSubscription.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java b/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java
index 84b8a4570c..fe964dd947 100644
--- a/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java
+++ b/src/main/java/org/springframework/data/redis/connection/util/ByteArraySet.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java b/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java
index 549ccdf11c..5a33c06642 100644
--- a/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java
+++ b/src/main/java/org/springframework/data/redis/connection/util/ByteArrayWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java b/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java
index b80989e887..3da38d5cad 100644
--- a/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java
+++ b/src/main/java/org/springframework/data/redis/connection/util/DecodeUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java b/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java
index 4b25f553da..083e386575 100644
--- a/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java
+++ b/src/main/java/org/springframework/data/redis/connection/zset/Aggregate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java b/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java
index 3862985bb8..bddd817e0a 100644
--- a/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java
+++ b/src/main/java/org/springframework/data/redis/connection/zset/DefaultTuple.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java b/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java
index 19c05a3385..a706af4a09 100644
--- a/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java
+++ b/src/main/java/org/springframework/data/redis/connection/zset/Tuple.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/connection/zset/Weights.java b/src/main/java/org/springframework/data/redis/connection/zset/Weights.java
index e06265dbeb..a40045f274 100644
--- a/src/main/java/org/springframework/data/redis/connection/zset/Weights.java
+++ b/src/main/java/org/springframework/data/redis/connection/zset/Weights.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java
index 24d445f515..d3f2a080d4 100644
--- a/src/main/java/org/springframework/data/redis/core/AbstractOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/AbstractOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
index 5164e22495..4250560c0a 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java b/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java
index 4f29335d5b..b7c30dc1b7 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundHashOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java b/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java
index 6e7b4c3e69..d719b05fb2 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundKeyOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundListOperations.java b/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
index 5b759f88a0..9c429debac 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundListOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java b/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java
index d4c7a5b522..a65b1e200c 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundOperationsProxyFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2022-2023 the original author or authors.
+ * Copyright 2022-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java b/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java
index e62599edd1..b9d03ab655 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java b/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java
index 8efbe822ba..b589c99163 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundStreamOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java b/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java
index d045407e85..b11d7c6657 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java b/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java
index 2cc68ff111..724cb5cd11 100644
--- a/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/BoundZSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/BulkMapper.java b/src/main/java/org/springframework/data/redis/core/BulkMapper.java
index b15f60f0ad..686b285f66 100644
--- a/src/main/java/org/springframework/data/redis/core/BulkMapper.java
+++ b/src/main/java/org/springframework/data/redis/core/BulkMapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java b/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java
index 58dce55e83..cdd8c26f1f 100644
--- a/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java
+++ b/src/main/java/org/springframework/data/redis/core/CloseSuppressingInvocationHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
index 5143128bdb..833ca61620 100644
--- a/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ClusterOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java
new file mode 100644
index 0000000000..1f5fe55704
--- /dev/null
+++ b/src/main/java/org/springframework/data/redis/core/ClusterOperationsEditor.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2016-2024 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.core;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ * PropertyEditor allowing for easy injection of {@link ClusterOperations} from {@link RedisOperations}.
+ *
+ * @author Mark Paluch
+ */
+class ClusterOperationsEditor extends PropertyEditorSupport {
+
+ public void setValue(Object value) {
+
+ if (value instanceof RedisOperations, ?> redisOperations) {
+ super.setValue(redisOperations.opsForCluster());
+ } else {
+ throw new IllegalArgumentException("Editor supports only conversion of type " + RedisOperations.class);
+ }
+ }
+}
diff --git a/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java
index 765a9f97b5..e80ea71d1a 100644
--- a/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java
+++ b/src/main/java/org/springframework/data/redis/core/ConvertingCursor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
@@ -69,6 +69,12 @@ public void close() {
}
@Override
+ public CursorId getId() {
+ return delegate.getId();
+ }
+
+ @Override
+ @Deprecated
public long getCursorId() {
return delegate.getCursorId();
}
diff --git a/src/main/java/org/springframework/data/redis/core/Cursor.java b/src/main/java/org/springframework/data/redis/core/Cursor.java
index d960936eee..fa60b0e489 100644
--- a/src/main/java/org/springframework/data/redis/core/Cursor.java
+++ b/src/main/java/org/springframework/data/redis/core/Cursor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
@@ -16,6 +16,7 @@
package org.springframework.data.redis.core;
import org.springframework.data.util.CloseableIterator;
+import org.springframework.util.Assert;
/**
* Cursor abstraction to scan over the keyspace or elements within a data structure using a variant of a {@code SCAN}
@@ -35,12 +36,22 @@
*/
public interface Cursor extends CloseableIterator {
+ /**
+ * Returns the reference cursor.
+ *
+ * @return the reference cursor.
+ * @since 3.2.1
+ */
+ CursorId getId();
+
/**
* Get the reference cursor.
* NOTE: the id might change while iterating items.
*
* @return
+ * @deprecated since 3.3.0, use {@link #getId()} instead as the cursorId can exceed {@link Long#MAX_VALUE}.
*/
+ @Deprecated(since = "3.3.0")
long getCursorId();
/**
@@ -52,4 +63,112 @@ public interface Cursor extends CloseableIterator {
* @return the current position of the cursor.
*/
long getPosition();
+
+ /**
+ * Value class representing a cursor identifier.
+ *
+ * @since 3.2.1
+ */
+ abstract class CursorId {
+
+ private final static CursorId INITIAL = new CursorId() {
+ @Override
+ public String getCursorId() {
+ return "0";
+ }
+ };
+
+ /**
+ * Creates a new initial {@link CursorId}.
+ *
+ * @return an initial {@link CursorId}.
+ */
+ public static CursorId initial() {
+ return INITIAL;
+ }
+
+ /**
+ * Creates a {@link CursorId} from the given {@code cursorId}.
+ *
+ * @param cursorId the provided cursor identifier.
+ * @return the provided cursor Id.
+ */
+ public static CursorId of(String cursorId) {
+
+ Assert.notNull(cursorId, "CursorId must not be null");
+
+ if (INITIAL.getCursorId().equals(cursorId)) {
+ return INITIAL;
+ }
+
+ return new CursorId() {
+
+ @Override
+ public String getCursorId() {
+ return cursorId;
+ }
+ };
+ }
+
+ /**
+ * Creates a {@link CursorId} from the given {@code cursorId}.
+ *
+ * @param cursorId the provided cursor identifier.
+ * @return the provided cursor Id.
+ */
+ public static CursorId of(long cursorId) {
+
+ if (cursorId == 0) {
+ return INITIAL;
+ }
+ return of(Long.toUnsignedString(cursorId));
+ }
+
+ /**
+ * Returns whether the given {@code cursorId} represent an initial cursor identifier to indicate an initial/finished
+ * cursor state.
+ *
+ * @param cursorId the cursor identifier to inspect.
+ * @return {@code true} if the cursorId represents an initial/finished state.
+ */
+ public static boolean isInitial(String cursorId) {
+ return INITIAL.getCursorId().equals(cursorId);
+ }
+
+ /**
+ * Returns whether the current cursor identifier represent an initial cursor identifier to indicate an
+ * initial/finished cursor state.
+ *
+ * @return {@code true} if the cursorId represents an initial/finished state.
+ */
+ public boolean isInitial() {
+ return INITIAL.getCursorId().equals(getCursorId());
+ }
+
+ /**
+ * @return the raw cursor Id.
+ */
+ public abstract String getCursorId();
+
+ @Override
+ public int hashCode() {
+ return getCursorId().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj instanceof CursorId other) {
+ return getCursorId().equals(other.getCursorId());
+ }
+
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getCursorId();
+ }
+
+ }
}
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java
index 00e2c2d33a..77a285ae0f 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultClusterOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
index 456a339fd0..e451cf97d7 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultGeoOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
index 51aa578f34..1bfb9c3467 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultHashOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java
index e62b1ae8db..41d8dc0406 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultHyperLogLogOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java
index 35419994cb..61855b8b0d 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultListOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
index 60f0ca6e1f..12192babd2 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveGeoOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java
index b1fd142b8c..fec1f2e7e1 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHashOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java
index 4c3258a2eb..d9c3516741 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveHyperLogLogOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
index cf863e7839..74297cd674 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveListOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java
index 63dc0debae..13b546689e 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
index 139bb2799e..432cf77283 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveStreamOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
index dd59f5bd18..0f0ac35200 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
index 469264ccd9..40869055e1 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultReactiveZSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
index 1e95a24b70..5949af8d73 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
index 724460801b..52eaa318ae 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultStreamOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java b/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java
index ea24a13b91..c26cdbe912 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultTypedTuple.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java
index 149543027f..9938d5a0ec 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
index cc663f21f5..059f746707 100644
--- a/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/DefaultZSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/GeoOperations.java b/src/main/java/org/springframework/data/redis/core/GeoOperations.java
index caba07e066..f06f2a88fc 100644
--- a/src/main/java/org/springframework/data/redis/core/GeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/GeoOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java
index 27b085eeeb..c55b5f55ab 100644
--- a/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java
+++ b/src/main/java/org/springframework/data/redis/core/GeoOperationsEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java b/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java
index 6ff90bf2bd..2b1b77547d 100644
--- a/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java
+++ b/src/main/java/org/springframework/data/redis/core/HashMapperProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/HashOperations.java b/src/main/java/org/springframework/data/redis/core/HashOperations.java
index 432ecbfe2f..8e98e49f97 100644
--- a/src/main/java/org/springframework/data/redis/core/HashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/HashOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java
index 17eaa7a4cc..30d31d81f2 100644
--- a/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java
+++ b/src/main/java/org/springframework/data/redis/core/HashOperationsEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java
index e5f07c87d0..0c16fa1be4 100644
--- a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java
new file mode 100644
index 0000000000..abf47663bc
--- /dev/null
+++ b/src/main/java/org/springframework/data/redis/core/HyperLogLogOperationsEditor.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2016-2024 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.core;
+
+import java.beans.PropertyEditorSupport;
+
+/**
+ * PropertyEditor allowing for easy injection of {@link HyperLogLogOperations} from {@link RedisOperations}.
+ *
+ * @author Mark Paluch
+ */
+class HyperLogLogOperationsEditor extends PropertyEditorSupport {
+
+ public void setValue(Object value) {
+
+ if (value instanceof RedisOperations, ?> redisOperations) {
+ super.setValue(redisOperations.opsForHyperLogLog());
+ } else {
+ throw new IllegalArgumentException("Editor supports only conversion of type " + RedisOperations.class);
+ }
+ }
+}
diff --git a/src/main/java/org/springframework/data/redis/core/IndexWriter.java b/src/main/java/org/springframework/data/redis/core/IndexWriter.java
index 1cb2d7ba91..a7f1cf5f60 100644
--- a/src/main/java/org/springframework/data/redis/core/IndexWriter.java
+++ b/src/main/java/org/springframework/data/redis/core/IndexWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java b/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java
index 0a9d79836e..2cc66d5d79 100644
--- a/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java
+++ b/src/main/java/org/springframework/data/redis/core/KeyBoundCursor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
@@ -31,17 +31,36 @@ public abstract class KeyBoundCursor extends ScanCursor {
*
* @param cursorId
* @param options Defaulted to {@link ScanOptions#NONE} if nulled.
+ * @deprecated since 3.3.0 - Use {@link KeyBoundCursor#KeyBoundCursor(byte[], CursorId, ScanOptions)} instead.
*/
+ @Deprecated(since = "3.3.0")
public KeyBoundCursor(byte[] key, long cursorId, @Nullable ScanOptions options) {
super(cursorId, options != null ? options : ScanOptions.NONE);
this.key = key;
}
+ /**
+ * Crates new {@link ScanCursor}
+ *
+ * @param cursorId
+ * @param options Defaulted to {@link ScanOptions#NONE} if nulled.
+ * @since 3.3.0
+ */
+ public KeyBoundCursor(byte[] key, CursorId cursorId, @Nullable ScanOptions options) {
+ super(cursorId, options != null ? options : ScanOptions.NONE);
+ this.key = key;
+ }
+
+ @Override
protected ScanIteration doScan(long cursorId, ScanOptions options) {
+ return doScan(CursorId.of(cursorId), options);
+ }
+
+ protected ScanIteration doScan(CursorId cursorId, ScanOptions options) {
return doScan(this.key, cursorId, options);
}
- protected abstract ScanIteration doScan(byte[] key, long cursorId, ScanOptions options);
+ protected abstract ScanIteration doScan(byte[] key, CursorId cursorId, ScanOptions options);
public byte[] getKey() {
return key;
diff --git a/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
index 1f114877f1..0cbb843732 100644
--- a/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
+++ b/src/main/java/org/springframework/data/redis/core/KeyScanOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ListOperations.java b/src/main/java/org/springframework/data/redis/core/ListOperations.java
index b838754b50..f5c8948385 100644
--- a/src/main/java/org/springframework/data/redis/core/ListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ListOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java b/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java
index f556f7c2dc..cf8fc18daa 100644
--- a/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java
+++ b/src/main/java/org/springframework/data/redis/core/ListOperationsEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/PartialUpdate.java b/src/main/java/org/springframework/data/redis/core/PartialUpdate.java
index 58bd0efb57..f516b1f65f 100644
--- a/src/main/java/org/springframework/data/redis/core/PartialUpdate.java
+++ b/src/main/java/org/springframework/data/redis/core/PartialUpdate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2023 the original author or authors.
+ * Copyright 2016-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java
index 99974cac70..76471777ae 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveGeoOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java
index 9516bdc508..0f2950654a 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java
index d19da8fd66..e0ed1f6148 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveHyperLogLogOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
index 0273ab292e..6a701c2eac 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveListOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java
index 0699827c0b..3a22e9a771 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java
index 8424daf4aa..c02d1eea81 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
@@ -103,10 +103,16 @@ public interface ReactiveRedisOperations {
/**
* Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param channels must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
* @since 2.1
+ * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
*/
default Flux extends Message> listenToChannel(String... channels) {
@@ -118,10 +124,16 @@ default Flux extends Message> listenToChannel(String... channels) {
/**
* Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for
* those.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param patterns must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
* @since 2.1
+ * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
*/
default Flux extends Message> listenToPattern(String... patterns) {
@@ -132,16 +144,27 @@ default Flux extends Message> listenToPattern(String... patterns) {
/**
* Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for
* those.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param topics must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
* @since 2.1
+ * @see org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer
*/
Flux extends Message> listenTo(Topic... topics);
/**
* Subscribe to the given Redis {@code channels} and emit {@link Message messages} received for those. The
* {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param channels must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
@@ -158,6 +181,11 @@ default Mono>> listenToChannelLater(String...
/**
* Subscribe to the Redis channels matching the given {@code pattern} and emit {@link Message messages} received for
* those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param patterns must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
@@ -173,6 +201,11 @@ default Mono>> listenToPatternLater(String...
/**
* Subscribe to the Redis channels for the given {@link Topic topics} and emit {@link Message messages} received for
* those. The {@link Mono} completes once the {@link Topic topic} subscriptions are registered.
+ *
+ * Note that this method allocates a new
+ * {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} and uses a dedicated
+ * connection, similar to other methods on this interface. Invoking this method multiple times is an indication that
+ * you should use {@link org.springframework.data.redis.listener.ReactiveRedisMessageListenerContainer} directly.
*
* @param topics must not be {@literal null}.
* @return a hot sequence of {@link Message messages}.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java
index b71e31bfab..3511b7ed02 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisSessionCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2023 the original author or authors.
+ * Copyright 2021-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
index 5d52051a2a..7816a744a8 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveRedisTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java
index f8d0feff61..eb9e55e431 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
index 73bf8f0d25..fc3ca29651 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveStreamOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2023 the original author or authors.
+ * Copyright 2018-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java b/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java
index 1c03c07920..a5a915e6e7 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveStringRedisTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java
index be8a0c0fbe..2a0f44404c 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java b/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java
index 1416b92c7e..552f008c24 100644
--- a/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/ReactiveZSetOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2023 the original author or authors.
+ * Copyright 2017-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java b/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
index c326f2b9ec..09c8decc24 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisCallback.java b/src/main/java/org/springframework/data/redis/core/RedisCallback.java
index 1faadc0c48..0c40d0702b 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisCallback.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java b/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java
index 0814716e62..b9ac36c83d 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisClusterCallback.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisCommand.java b/src/main/java/org/springframework/data/redis/core/RedisCommand.java
index 12da22abac..5621a216d9 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisCommand.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2023 the original author or authors.
+ * Copyright 2014-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
index 0502843817..20e4954ae0 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
@@ -32,6 +32,7 @@
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
+import org.springframework.util.ReflectionUtils;
/**
* Helper class that provides static methods for obtaining {@link RedisConnection} from a
@@ -320,8 +321,8 @@ private static RedisConnection getTargetConnection(RedisConnection connection) {
*/
public static void unbindConnection(RedisConnectionFactory factory) {
- RedisConnectionHolder connectionHolder =
- (RedisConnectionHolder) TransactionSynchronizationManager.getResource(factory);
+ RedisConnectionHolder connectionHolder = (RedisConnectionHolder) TransactionSynchronizationManager
+ .getResource(factory);
if (connectionHolder == null) {
return;
@@ -358,7 +359,8 @@ public static void unbindConnection(RedisConnectionFactory factory) {
* @param connectionFactory Redis connection factory that the connection was created with
* @return whether the connection is transactional or not
*/
- public static boolean isConnectionTransactional(RedisConnection connection, RedisConnectionFactory connectionFactory) {
+ public static boolean isConnectionTransactional(RedisConnection connection,
+ RedisConnectionFactory connectionFactory) {
Assert.notNull(connectionFactory, "No RedisConnectionFactory specified");
@@ -448,9 +450,16 @@ public void afterCompletion(int status) {
static class ConnectionSplittingInterceptor implements MethodInterceptor {
private final RedisConnectionFactory factory;
+ private final @Nullable Method commandInterfaceMethod;
public ConnectionSplittingInterceptor(RedisConnectionFactory factory) {
this.factory = factory;
+ this.commandInterfaceMethod = null;
+ }
+
+ private ConnectionSplittingInterceptor(RedisConnectionFactory factory, Method commandInterfaceMethod) {
+ this.factory = factory;
+ this.commandInterfaceMethod = commandInterfaceMethod;
}
@Override
@@ -465,6 +474,22 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab
return obj;
}
+ Class> returnType = method.getReturnType();
+ String returnTypeName = returnType.getSimpleName();
+
+ // bridge keyCommands etc. to defer target invocations
+ if (returnType.isInterface() && returnType.getPackageName().equals("org.springframework.data.redis.connection")
+ && returnTypeName.startsWith("Redis") && returnTypeName.endsWith("Commands")) {
+
+ ProxyFactory proxyFactory = new ProxyFactory(ReflectionUtils.invokeMethod(method, obj));
+
+ proxyFactory.addAdvice(new ConnectionSplittingInterceptor(factory, method));
+ proxyFactory.addInterface(RedisConnectionProxy.class);
+ proxyFactory.addInterface(returnType);
+
+ return proxyFactory.getProxy();
+ }
+
RedisCommand commandToExecute = RedisCommand.failsafeCommandLookup(method.getName());
if (isPotentiallyThreadBoundCommand(commandToExecute)) {
@@ -481,9 +506,15 @@ public Object intercept(Object obj, Method method, Object[] args) throws Throwab
}
RedisConnection connection = factory.getConnection();
-
+ Object target = connection;
try {
- return invoke(method, connection, args);
+
+ if (commandInterfaceMethod != null) {
+ target = ReflectionUtils.invokeMethod(commandInterfaceMethod,
+ connection);
+ }
+
+ return invoke(method, target, args);
} finally {
// properly close the unbound connection after executing command
if (!connection.isClosed()) {
diff --git a/src/main/java/org/springframework/data/redis/core/RedisHash.java b/src/main/java/org/springframework/data/redis/core/RedisHash.java
index 2d9a098b98..b0cb2a1ea1 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisHash.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisHash.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java b/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java
index 8405e9b1d7..a57f5fee93 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisKeyExpiredEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java
index 76d9439207..6aaabbe156 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
index acda71c7ce..edbe5c2ff6 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisKeyValueTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java b/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java
index 7e9af02b1e..3a5b6b342f 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisKeyspaceEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisOperations.java b/src/main/java/org/springframework/data/redis/core/RedisOperations.java
index 41aabae108..7128522447 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisOperations.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2023 the original author or authors.
+ * Copyright 2011-2024 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.
diff --git a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java
index 82d8da2a14..07b946d2b9 100644
--- a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java
+++ b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2023 the original author or authors.
+ * Copyright 2015-2024 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.
@@ -20,8 +20,10 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.GeoResult;
@@ -31,10 +33,15 @@
import org.springframework.data.keyvalue.core.SortAccessor;
import org.springframework.data.keyvalue.core.SpelSortAccessor;
import org.springframework.data.keyvalue.core.query.KeyValueQuery;
+import org.springframework.data.mapping.PersistentPropertyPath;
+import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation;
import org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs;
+import org.springframework.data.redis.connection.util.ByteArrayWrapper;
import org.springframework.data.redis.core.convert.GeoIndexedPropertyValue;
+import org.springframework.data.redis.core.convert.RedisConverter;
import org.springframework.data.redis.core.convert.RedisData;
+import org.springframework.data.redis.core.mapping.RedisPersistentProperty;
import org.springframework.data.redis.repository.query.RedisOperationChain;
import org.springframework.data.redis.repository.query.RedisOperationChain.NearPath;
import org.springframework.data.redis.repository.query.RedisOperationChain.PathAndValue;
@@ -48,6 +55,7 @@
*
* @author Christoph Strobl
* @author Mark Paluch
+ * @author Junghoon Ban
* @since 1.7
*/
class RedisQueryEngine extends QueryEngine> {
@@ -73,7 +81,7 @@ private RedisQueryEngine(CriteriaAccessor criteriaAccessor,
@Override
@SuppressWarnings("unchecked")
- public Collection execute(RedisOperationChain criteria, Comparator> sort, long offset, int rows,
+ public List execute(RedisOperationChain criteria, Comparator> sort, long offset, int rows,
String keyspace, Class type) {
List result = doFind(criteria, offset, rows, keyspace, type);
@@ -89,48 +97,26 @@ private List doFind(RedisOperationChain criteria, long offset, int rows,
if (criteria == null
|| (CollectionUtils.isEmpty(criteria.getOrSismember()) && CollectionUtils.isEmpty(criteria.getSismember()))
&& criteria.getNear() == null) {
- return getAdapter().getAllOf(keyspace, type, offset, rows);
+ return getRequiredAdapter().getAllOf(keyspace, type, offset, rows);
}
RedisCallback>> callback = connection -> {
- List allKeys = new ArrayList<>();
- if (!criteria.getSismember().isEmpty()) {
- allKeys.addAll(connection.sInter(keys(keyspace + ":", criteria.getSismember())));
- }
-
- if (!criteria.getOrSismember().isEmpty()) {
- allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember())));
- }
-
- if (criteria.getNear() != null) {
-
- GeoRadiusCommandArgs limit = GeoRadiusCommandArgs.newGeoRadiusArgs();
-
- if (rows > 0) {
- limit = limit.limit(rows);
- }
-
- GeoResults> x = connection.geoRadius(geoKey(keyspace + ":", criteria.getNear()),
- new Circle(criteria.getNear().getPoint(), criteria.getNear().getDistance()), limit);
- for (GeoResult