From 10ebbf45cf24b3c8c92030cc924302add6c7a5dc Mon Sep 17 00:00:00 2001 From: Thach Le Date: Tue, 4 Jun 2024 21:27:32 +0700 Subject: [PATCH 01/28] Remove not readonly commands #2832 --- .../io/lettuce/core/masterreplica/ReadOnlyCommands.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java index 67616a7ef5..10b2db694f 100644 --- a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java @@ -57,11 +57,11 @@ public static Set getReadOnlyCommands() { } enum CommandName { - ASKING, BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL_RO, EVALSHA_RO, EXISTS, FCALL_RO, // - GEODIST, GEOPOS, GEORADIUS, GEORADIUS_RO, GEORADIUSBYMEMBER, GEORADIUSBYMEMBER_RO, GEOSEARCH, GEOHASH, GET, GETBIT, // + BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL_RO, EVALSHA_RO, EXISTS, FCALL_RO, // + GEODIST, GEOPOS, GEORADIUS_RO, GEORADIUSBYMEMBER_RO, GEOHASH, GET, GETBIT, // GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, SORT_RO, MGET, PFCOUNT, PTTL, // - RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // + RANDOMKEY, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // SUNION, TIME, TTL, TYPE, // XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // From e3080fd3e6b755aa7e217cb97ace59e72db8270c Mon Sep 17 00:00:00 2001 From: Thach Le Date: Sat, 8 Jun 2024 12:35:51 +0700 Subject: [PATCH 02/28] Fix comment Add test --- .../core/masterreplica/ReadOnlyCommands.java | 72 ------------------- .../core/protocol/ReadOnlyCommands.java | 4 +- .../ClusterReadOnlyCommandsUnitTests.java | 2 +- .../ReadOnlyCommandIntegrationTests.java | 61 ++++++++++++++++ 4 files changed, 64 insertions(+), 75 deletions(-) delete mode 100644 src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java create mode 100644 src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java diff --git a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java deleted file mode 100644 index 10b2db694f..0000000000 --- a/src/main/java/io/lettuce/core/masterreplica/ReadOnlyCommands.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2020-Present, Redis Ltd. and Contributors - * All rights reserved. - * - * Licensed under the MIT License. - * - * This file contains contributions from third-party contributors - * 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 io.lettuce.core.masterreplica; - -import java.util.Collections; -import java.util.EnumSet; -import java.util.Set; - -import io.lettuce.core.protocol.CommandType; -import io.lettuce.core.protocol.ProtocolKeyword; - -/** - * Contains all command names that are read-only commands. - * - * @author Mark Paluch - */ -class ReadOnlyCommands { - - private static final Set READ_ONLY_COMMANDS = EnumSet.noneOf(CommandType.class); - - static { - for (CommandName commandNames : CommandName.values()) { - READ_ONLY_COMMANDS.add(CommandType.valueOf(commandNames.name())); - } - } - - /** - * @param protocolKeyword must not be {@code null}. - * @return {@code true} if {@link ProtocolKeyword} is a read-only command. - */ - public static boolean isReadOnlyCommand(ProtocolKeyword protocolKeyword) { - return READ_ONLY_COMMANDS.contains(protocolKeyword); - } - - /** - * @return an unmodifiable {@link Set} of {@link CommandType read-only} commands. - */ - public static Set getReadOnlyCommands() { - return Collections.unmodifiableSet(READ_ONLY_COMMANDS); - } - - enum CommandName { - BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL_RO, EVALSHA_RO, EXISTS, FCALL_RO, // - GEODIST, GEOPOS, GEORADIUS_RO, GEORADIUSBYMEMBER_RO, GEOHASH, GET, GETBIT, // - GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // - HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, SORT_RO, MGET, PFCOUNT, PTTL, // - RANDOMKEY, SCAN, SCARD, SCRIPT, // - SDIFF, SINTER, SISMEMBER, SMISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // - SUNION, TIME, TTL, TYPE, // - XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // - ZCARD, ZCOUNT, ZLEXCOUNT, ZRANGE, // - ZRANDMEMBER, ZRANGEBYLEX, ZRANGEBYSCORE, ZRANK, ZREVRANGE, ZREVRANGEBYLEX, ZREVRANGEBYSCORE, ZREVRANK, ZSCAN, ZSCORE, - } - -} diff --git a/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java index a6bfc6333f..d116b0fb48 100644 --- a/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java @@ -71,10 +71,10 @@ public static ReadOnlyPredicate asPredicate() { enum CommandName { ASKING, BITCOUNT, BITPOS, CLIENT, COMMAND, DUMP, ECHO, EVAL_RO, EVALSHA_RO, EXISTS, FCALL_RO, // - GEODIST, GEOPOS, GEORADIUS, GEORADIUS_RO, GEORADIUSBYMEMBER, GEORADIUSBYMEMBER_RO, GEOSEARCH, GEOHASH, GET, GETBIT, // + GEODIST, GEOPOS, GEORADIUS_RO, GEORADIUSBYMEMBER_RO, GEOSEARCH, GEOHASH, GET, GETBIT, // GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, SORT_RO, MGET, PFCOUNT, PTTL, // - RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // + RANDOMKEY, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // SUNION, TIME, TTL, TYPE, // XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // diff --git a/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java index b1f6cad9ff..0f7bed34e0 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java @@ -16,7 +16,7 @@ class ClusterReadOnlyCommandsUnitTests { @Test void testCount() { - assertThat(ClusterReadOnlyCommands.getReadOnlyCommands()).hasSize(86); + assertThat(ClusterReadOnlyCommands.getReadOnlyCommands()).hasSize(83); } @Test diff --git a/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java new file mode 100644 index 0000000000..a5e4a063ed --- /dev/null +++ b/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java @@ -0,0 +1,61 @@ +package io.lettuce.core.commands; + +import io.lettuce.core.TestSupport; +import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.cluster.ClusterReadOnlyCommands; +import io.lettuce.core.cluster.ClusterTestUtil; +import io.lettuce.core.cluster.api.StatefulRedisClusterConnection; +import io.lettuce.core.cluster.api.sync.RedisClusterCommands; +import io.lettuce.core.protocol.CommandType; +import io.lettuce.core.protocol.ProtocolKeyword; +import io.lettuce.core.protocol.ReadOnlyCommands; +import io.lettuce.test.KeyValueStreamingAdapter; +import io.lettuce.test.LettuceExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; + +import javax.inject.Inject; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Thach Le + */ +@ExtendWith(LettuceExtension.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class ReadOnlyCommandIntegrationTests extends TestSupport { + + private final RedisCommands redis; + + @Inject + protected ReadOnlyCommandIntegrationTests(RedisCommands redis) { + this.redis = redis; + } + + @BeforeEach + void setUp() { + redis.flushall(); + } + + @Test + void testReadOnlyCommands() { + for (ProtocolKeyword readOnlyCommand : ClusterReadOnlyCommands.getReadOnlyCommands()) { + assertThat(isCommandReadOnly(readOnlyCommand.name())).isTrue(); + } + } + + private boolean isCommandReadOnly(String commandName) { + List commandInfo = redis.commandInfo(commandName); + if (commandInfo == null || commandInfo.isEmpty()) { + throw new IllegalArgumentException("Command not found: " + commandName); + } + + List flags = (List) commandInfo.get(2); // Index 2 is the flags list + return flags.contains("readonly") && !flags.contains("write"); + } +} From 36dc55ae530d6430df83a5dde69c43a3f63c9b62 Mon Sep 17 00:00:00 2001 From: Thach Le Date: Mon, 10 Jun 2024 20:22:21 +0700 Subject: [PATCH 03/28] Update test --- .../ReadOnlyCommandIntegrationTests.java | 61 ------------------- .../ServerCommandIntegrationTests.java | 23 +++++++ 2 files changed, 23 insertions(+), 61 deletions(-) delete mode 100644 src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java diff --git a/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java deleted file mode 100644 index a5e4a063ed..0000000000 --- a/src/test/java/io/lettuce/core/commands/ReadOnlyCommandIntegrationTests.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.lettuce.core.commands; - -import io.lettuce.core.TestSupport; -import io.lettuce.core.api.sync.RedisCommands; -import io.lettuce.core.cluster.ClusterReadOnlyCommands; -import io.lettuce.core.cluster.ClusterTestUtil; -import io.lettuce.core.cluster.api.StatefulRedisClusterConnection; -import io.lettuce.core.cluster.api.sync.RedisClusterCommands; -import io.lettuce.core.protocol.CommandType; -import io.lettuce.core.protocol.ProtocolKeyword; -import io.lettuce.core.protocol.ReadOnlyCommands; -import io.lettuce.test.KeyValueStreamingAdapter; -import io.lettuce.test.LettuceExtension; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExtendWith; - -import javax.inject.Inject; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * @author Thach Le - */ -@ExtendWith(LettuceExtension.class) -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -class ReadOnlyCommandIntegrationTests extends TestSupport { - - private final RedisCommands redis; - - @Inject - protected ReadOnlyCommandIntegrationTests(RedisCommands redis) { - this.redis = redis; - } - - @BeforeEach - void setUp() { - redis.flushall(); - } - - @Test - void testReadOnlyCommands() { - for (ProtocolKeyword readOnlyCommand : ClusterReadOnlyCommands.getReadOnlyCommands()) { - assertThat(isCommandReadOnly(readOnlyCommand.name())).isTrue(); - } - } - - private boolean isCommandReadOnly(String commandName) { - List commandInfo = redis.commandInfo(commandName); - if (commandInfo == null || commandInfo.isEmpty()) { - throw new IllegalArgumentException("Command not found: " + commandName); - } - - List flags = (List) commandInfo.get(2); // Index 2 is the flags list - return flags.contains("readonly") && !flags.contains("write"); - } -} diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index e9e8e35f61..ebdfa61ad1 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -33,6 +33,8 @@ import javax.inject.Inject; +import io.lettuce.core.cluster.ClusterReadOnlyCommands; +import io.lettuce.core.protocol.ProtocolKeyword; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -573,6 +575,13 @@ void clientSetinfo() { assertThat(redis.clientInfo().contains("lib-name=lettuce")).isTrue(); } + @Test + void testReadOnlyCommands() { + for (ProtocolKeyword readOnlyCommand : ClusterReadOnlyCommands.getReadOnlyCommands()) { + assertThat(isCommandReadOnly(readOnlyCommand.name())).isTrue(); + } + } + private boolean noSaveInProgress() { String info = redis.info(); @@ -580,4 +589,18 @@ private boolean noSaveInProgress() { return !info.contains("aof_rewrite_in_progress:1") && !info.contains("rdb_bgsave_in_progress:1"); } + private boolean isCommandReadOnly(String commandName) { + List commandInfo = redis.commandInfo(commandName); + if (commandInfo == null || commandInfo.isEmpty()) { + throw new IllegalArgumentException("Command not found: " + commandName); + } + + List details = CommandDetailParser.parse(List.of(commandInfo)); + if (details.isEmpty()) { + throw new IllegalArgumentException("Command details could not be parsed: " + commandName); + } + + CommandDetail detail = details.get(0); + return detail.getFlags().contains(CommandDetail.Flag.READONLY) && !detail.getFlags().contains(CommandDetail.Flag.WRITE); + } } From 1dcef97db32eabdf7183bd449360e1c794d176a5 Mon Sep 17 00:00:00 2001 From: atakavci <58048133+atakavci@users.noreply.github.com> Date: Wed, 24 Apr 2024 15:56:56 +0300 Subject: [PATCH 04/28] Update cicd.yaml workaround for apt update issue related to Clearsigned file --- .github/workflows/cicd.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 692738de40..3846e60083 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -36,7 +36,9 @@ jobs: java-version: 8 - name: Install missing dependencies to container run: | - sudo apt update + : # workaround for apt update issue related to Clearsigned file + : # details on https://github.com/orgs/community/discussions/120966#discussioncomment-9211925 + sudo apt update || true sudo apt install -y stunnel make git gcc - name: Maven offline run: | From 430945efb45f59218eb44c6d5adc51f64b7ad869 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Thu, 25 Apr 2024 16:14:46 +0300 Subject: [PATCH 05/28] GitHub issue template polishing and stale issues action (#2833) * GitHub issue template polishing and stale issues action * Addressing feedback on message test and a better label for the stale issues --- .github/ISSUE_TEMPLATE/Bug_report.md | 1 + .github/ISSUE_TEMPLATE/Help_us.md | 15 --------------- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- .github/workflows/stale-issues.yml | 26 ++++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 17 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Help_us.md create mode 100644 .github/workflows/stale-issues.yml diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 6f1e9aeb30..08bee3b85b 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -11,6 +11,7 @@ labels: 'type: waiting-for-triage' #### Current Behavior +
Stack trace diff --git a/.github/ISSUE_TEMPLATE/Help_us.md b/.github/ISSUE_TEMPLATE/Help_us.md deleted file mode 100644 index ec438fda1b..0000000000 --- a/.github/ISSUE_TEMPLATE/Help_us.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -name: 🤝 Support us on Lettuce -about: If you would like to support our efforts in maintaining this community-driven project 🙌! - ---- - -Help support Lettuce! - -Lettuce has always been a community project, not really backed or owned by any single (or group) of companies. While some maintainers used to work at companies supporting open source no one was working on it full time and there certainly isn't a huge company or team anywhere doing all this work. - ---- - -As a group of volunteers you can help us in a few ways - -- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/LettuceDriver) or [Gitter](https://gitter.im/lettuce-io/Lobby) for guidance). Companies should be paying their employees to contribute back to the open source projects they use everyday. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 726722a748..8e341873b7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,5 +3,5 @@ contact_links: url: https://github.com/lettuce-io/lettuce-core/discussions about: Use GitHub discussions to discuss an enhancement proposal or if you have a question - name: Questions - url: https://gitter.im/lettuce-io/Lobby - about: Please ask questions on Gitter or StackOverflow. + url: https://discord.gg/redis + about: Please ask questions on Discord or StackOverflow. diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml new file mode 100644 index 0000000000..c7f091def9 --- /dev/null +++ b/.github/workflows/stale-issues.yml @@ -0,0 +1,26 @@ +name: "Close stale issues" +on: + schedule: + - cron: "0 0 * * *" # once a day at midnight + +permissions: {} +jobs: + stale: + permissions: + issues: write # to close stale issues (actions/stale) + pull-requests: write # to close stale PRs (actions/stale) + + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 30 days this issue will be closed.' + stale-pr-message: 'Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.' + days-before-stale: 365 + days-before-close: 30 + stale-issue-label: "status: feedback-reminder" + stale-pr-label: "status: feedback-reminder" + operations-per-run: 10 + remove-stale-when-updated: false + only-labels: "status: waiting-for-feedback" From c1d213c68e0ce97d04a727087486cad323dd7aa8 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Thu, 25 Apr 2024 17:39:03 +0300 Subject: [PATCH 06/28] Implement HEXPIRE, HEXPIREAT, HEXPIRETIME and HPERSIST (#2836) * HEXPIRE implemented with integration tests * Polishing to integration test, added unit test * Move new commands to RedisHashCommands, added HEXPIREAT, HEXPIRETIME and HPERSIST * Make sure we reset the configuration setting after the new hash commands were tested * Broke one test because of wrong configuration setting; the other is unstable, trying to fix it * Polishing imports * Polishin : Copyright change not needed --- .../core/AbstractRedisAsyncCommands.java | 86 +++++++++- .../core/AbstractRedisReactiveCommands.java | 87 ++++++++-- .../io/lettuce/core/RedisCommandBuilder.java | 77 +++++++-- .../api/async/RedisHashAsyncCommands.java | 158 ++++++++++++++++- .../reactive/RedisHashReactiveCommands.java | 160 +++++++++++++++++- .../core/api/sync/RedisHashCommands.java | 158 ++++++++++++++++- .../async/NodeSelectionHashAsyncCommands.java | 158 ++++++++++++++++- .../api/sync/NodeSelectionHashCommands.java | 158 ++++++++++++++++- .../io/lettuce/core/protocol/CommandType.java | 2 +- .../coroutines/RedisHashCoroutinesCommands.kt | 159 ++++++++++++++++- .../RedisHashCoroutinesCommandsImpl.kt | 58 +++++++ .../lettuce/core/api/RedisHashCommands.java | 147 ++++++++++++++++ .../core/RedisClientIntegrationTests.java | 27 +-- .../core/RedisCommandBuilderUnitTests.java | 66 +++++++- .../commands/HashCommandIntegrationTests.java | 124 ++++++++++++-- 15 files changed, 1539 insertions(+), 86 deletions(-) diff --git a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java index f2c6c625ce..8b09c6b2e2 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java @@ -19,15 +19,6 @@ */ package io.lettuce.core; -import static io.lettuce.core.protocol.CommandType.*; - -import java.time.Duration; -import java.time.Instant; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - import io.lettuce.core.GeoArgs.Unit; import io.lettuce.core.api.StatefulConnection; import io.lettuce.core.api.async.*; @@ -50,6 +41,19 @@ import io.lettuce.core.protocol.ProtocolKeyword; import io.lettuce.core.protocol.RedisCommand; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static io.lettuce.core.protocol.CommandType.EXEC; +import static io.lettuce.core.protocol.CommandType.GEORADIUS; +import static io.lettuce.core.protocol.CommandType.GEORADIUSBYMEMBER; +import static io.lettuce.core.protocol.CommandType.GEORADIUSBYMEMBER_RO; +import static io.lettuce.core.protocol.CommandType.GEORADIUS_RO; + /** * An asynchronous and thread-safe API for a Redis connection. * @@ -794,6 +798,27 @@ public RedisFuture expire(K key, Duration seconds, ExpireArgs expireArg return expire(key, seconds.toMillis() / 1000, expireArgs); } + @Override + public RedisFuture hexpire(K key, long seconds, K... fields) { + return hexpire(key, seconds, null, fields); + } + + @Override + public RedisFuture hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + return dispatch(commandBuilder.hexpire(key, seconds, expireArgs, fields)); + } + + @Override + public RedisFuture hexpire(K key, Duration seconds, K... fields) { + return hexpire(key, seconds, null, fields); + } + + @Override + public RedisFuture hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(seconds, "Timeout must not be null"); + return hexpire(key, seconds.toMillis() / 1000, expireArgs, fields); + } + @Override public RedisFuture expireat(K key, long timestamp) { return expireat(key, timestamp, null); @@ -826,11 +851,49 @@ public RedisFuture expireat(K key, Instant timestamp, ExpireArgs expire return expireat(key, timestamp.toEpochMilli() / 1000, expireArgs); } + @Override + public RedisFuture hexpireat(K key, long timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + return dispatch(commandBuilder.hexpireat(key, timestamp, expireArgs, fields)); + + } + + @Override + public RedisFuture hexpireat(K key, Date timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hexpireat(key, timestamp.getTime() / 1000, expireArgs, fields); + } + + @Override + public RedisFuture hexpireat(K key, Instant timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hexpireat(key, timestamp.toEpochMilli() / 1000, expireArgs, fields); + } + @Override public RedisFuture expiretime(K key) { return dispatch(commandBuilder.expiretime(key)); } + @Override + public RedisFuture hexpiretime(K key, K... fields) { + return dispatch(commandBuilder.hexpiretime(key, fields)); + } + @Override public RedisFuture fcall(String function, ScriptOutputType type, K... keys) { return dispatch(commandBuilder.fcall(function, type, false, keys)); @@ -1489,6 +1552,11 @@ public RedisFuture persist(K key) { return dispatch(commandBuilder.persist(key)); } + @Override + public RedisFuture hpersist(K key, K... fields) { + return dispatch(commandBuilder.hpersist(key, fields)); + } + @Override public RedisFuture pexpire(K key, long milliseconds) { return pexpire(key, milliseconds, null); diff --git a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java index 47b473495e..47006ac03d 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java @@ -19,16 +19,6 @@ */ package io.lettuce.core; -import static io.lettuce.core.protocol.CommandType.*; - -import java.time.Duration; -import java.time.Instant; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Supplier; - import io.lettuce.core.GeoArgs.Unit; import io.lettuce.core.api.StatefulConnection; import io.lettuce.core.api.reactive.*; @@ -59,6 +49,20 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Supplier; + +import static io.lettuce.core.protocol.CommandType.EXEC; +import static io.lettuce.core.protocol.CommandType.GEORADIUS; +import static io.lettuce.core.protocol.CommandType.GEORADIUSBYMEMBER; +import static io.lettuce.core.protocol.CommandType.GEORADIUSBYMEMBER_RO; +import static io.lettuce.core.protocol.CommandType.GEORADIUS_RO; + /** * A reactive and thread-safe API for a Redis connection. * @@ -854,6 +858,27 @@ public Mono expire(K key, Duration seconds, ExpireArgs expireArgs) { return expire(key, seconds.toMillis() / 1000, expireArgs); } + @Override + public Mono hexpire(K key, long seconds, K... fields) { + return hexpire(key, seconds, null, fields); + } + + @Override + public Mono hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + return createMono(() -> commandBuilder.hexpire(key, seconds, expireArgs, fields)); + } + + @Override + public Mono hexpire(K key, Duration seconds, K... fields) { + return hexpire(key, seconds, null, fields); + } + + @Override + public Mono hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(seconds, "Timeout must not be null"); + return hexpire(key, seconds.toMillis() / 1000, expireArgs, fields); + } + @Override public Mono expireat(K key, long timestamp) { return expireat(key, timestamp, null); @@ -886,11 +911,48 @@ public Mono expireat(K key, Instant timestamp, ExpireArgs expireArgs) { return expireat(key, timestamp.toEpochMilli() / 1000, expireArgs); } + @Override + public Mono hexpireat(K key, long timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public Mono hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + return createMono(() -> commandBuilder.hexpireat(key, timestamp, expireArgs, fields)); + } + + @Override + public Mono hexpireat(K key, Date timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public Mono hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hexpireat(key, timestamp.getTime() / 1000, expireArgs, fields); + } + + @Override + public Mono hexpireat(K key, Instant timestamp, K... fields) { + return hexpireat(key, timestamp, null, fields); + } + + @Override + public Mono hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hexpireat(key, timestamp.toEpochMilli() / 1000, expireArgs, fields); + } + @Override public Mono expiretime(K key) { return createMono(() -> commandBuilder.expiretime(key)); } + @Override + public Mono hexpiretime(K key, K... fields) { + return createMono(() -> commandBuilder.hexpiretime(key, fields)); + } + @Override public Flux fcall(String function, ScriptOutputType type, K... keys) { return createFlux(() -> commandBuilder.fcall(function, type, false, keys)); @@ -1556,6 +1618,11 @@ public Mono persist(K key) { return createMono(() -> commandBuilder.persist(key)); } + @Override + public Mono hpersist(K key, K... fields) { + return createMono(() -> commandBuilder.hpersist(key, fields)); + } + @Override public Mono pexpire(K key, long milliseconds) { return pexpire(key, milliseconds, null); diff --git a/src/main/java/io/lettuce/core/RedisCommandBuilder.java b/src/main/java/io/lettuce/core/RedisCommandBuilder.java index 3d3d2be0be..143fc6cd89 100644 --- a/src/main/java/io/lettuce/core/RedisCommandBuilder.java +++ b/src/main/java/io/lettuce/core/RedisCommandBuilder.java @@ -19,19 +19,6 @@ */ package io.lettuce.core; -import static io.lettuce.core.internal.LettuceStrings.*; -import static io.lettuce.core.protocol.CommandKeyword.*; -import static io.lettuce.core.protocol.CommandType.*; -import static io.lettuce.core.protocol.CommandType.COPY; -import static io.lettuce.core.protocol.CommandType.SAVE; - -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - import io.lettuce.core.Range.Boundary; import io.lettuce.core.XReadArgs.StreamOffset; import io.lettuce.core.codec.RedisCodec; @@ -48,6 +35,19 @@ import io.lettuce.core.protocol.CommandType; import io.lettuce.core.protocol.RedisCommand; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static io.lettuce.core.internal.LettuceStrings.string; +import static io.lettuce.core.protocol.CommandKeyword.*; +import static io.lettuce.core.protocol.CommandType.*; +import static io.lettuce.core.protocol.CommandType.COPY; +import static io.lettuce.core.protocol.CommandType.SAVE; + /** * @param * @param @@ -978,6 +978,38 @@ Command expire(K key, long seconds, ExpireArgs expireArgs) { return createCommand(EXPIRE, new BooleanOutput<>(codec), args); } + Command hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + notNullKey(key); + notEmpty(fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key).add(seconds); + + if (expireArgs != null) { + expireArgs.build(args); + } + + args.add(fields.length); + args.addKeys(fields); + + return createCommand(HEXPIRE, new BooleanOutput<>(codec), args); + } + + Command hexpireat(K key, long seconds, ExpireArgs expireArgs, K... fields) { + notNullKey(key); + notEmpty(fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key).add(seconds); + + if (expireArgs != null) { + expireArgs.build(args); + } + + args.add(fields.length); + args.addKeys(fields); + + return createCommand(HEXPIREAT, new BooleanOutput<>(codec), args); + } + Command expireat(K key, long timestamp, ExpireArgs expireArgs) { notNullKey(key); @@ -997,6 +1029,15 @@ Command expiretime(K key) { return createCommand(EXPIRETIME, new IntegerOutput<>(codec), args); } + Command hexpiretime(K key, K... fields) { + notNullKey(key); + + CommandArgs args = new CommandArgs<>(codec).addKey(key); + args.add(fields.length); + args.addKeys(fields); + return createCommand(HEXPIRETIME, new IntegerOutput<>(codec), args); + } + Command flushall() { return createCommand(FLUSHALL, new StatusOutput<>(codec)); } @@ -2043,6 +2084,16 @@ Command persist(K key) { return createCommand(PERSIST, new BooleanOutput<>(codec), key); } + Command hpersist(K key, K... fields) { + notNullKey(key); + + CommandArgs args = new CommandArgs<>(codec).addKey(key); + args.add(fields.length); + args.addKeys(fields); + + return createCommand(HPERSIST, new BooleanOutput<>(codec), args); + } + Command pexpire(K key, long milliseconds, ExpireArgs expireArgs) { notNullKey(key); diff --git a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java index cc9b8b1489..9f514450fa 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java @@ -19,9 +19,7 @@ */ package io.lettuce.core.api.async; -import java.util.List; -import java.util.Map; - +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; @@ -33,6 +31,12 @@ import io.lettuce.core.output.KeyValueStreamingChannel; import io.lettuce.core.output.ValueStreamingChannel; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * Asynchronous executed commands for Hashes (Key-Value pairs). * @@ -429,4 +433,152 @@ public interface RedisHashAsyncCommands { * @return Long count of the keys. */ RedisFuture hvals(ValueStreamingChannel channel, K key); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + RedisFuture hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + RedisFuture hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + RedisFuture hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + RedisFuture hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + RedisFuture hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + RedisFuture hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + RedisFuture hpersist(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java index 080087510a..e02fe5b80a 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java @@ -19,10 +19,7 @@ */ package io.lettuce.core.api.reactive; -import java.util.Map; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; @@ -32,6 +29,13 @@ import io.lettuce.core.output.KeyStreamingChannel; import io.lettuce.core.output.KeyValueStreamingChannel; import io.lettuce.core.output.ValueStreamingChannel; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.Map; /** * Reactive executed commands for Hashes (Key-Value pairs). @@ -451,4 +455,152 @@ public interface RedisHashReactiveCommands { */ @Deprecated Mono hvals(ValueStreamingChannel channel, K key); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Mono hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Mono hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Mono hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Mono hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Mono hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Mono hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + Mono hpersist(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java index 816ec08227..ab41a1cafd 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java @@ -19,9 +19,7 @@ */ package io.lettuce.core.api.sync; -import java.util.List; -import java.util.Map; - +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; @@ -32,6 +30,12 @@ import io.lettuce.core.output.KeyValueStreamingChannel; import io.lettuce.core.output.ValueStreamingChannel; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * Synchronous executed commands for Hashes (Key-Value pairs). * @@ -430,4 +434,152 @@ public interface RedisHashCommands { * @return Long count of the keys. */ Long hvals(ValueStreamingChannel channel, K key); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Long hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + Boolean hpersist(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java index dd99fd23b0..442444c6ed 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java @@ -19,9 +19,7 @@ */ package io.lettuce.core.cluster.api.async; -import java.util.List; -import java.util.Map; - +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; @@ -32,6 +30,12 @@ import io.lettuce.core.output.KeyValueStreamingChannel; import io.lettuce.core.output.ValueStreamingChannel; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * Asynchronous executed commands on a node selection for Hashes (Key-Value pairs). * @@ -428,4 +432,152 @@ public interface NodeSelectionHashAsyncCommands { * @return Long count of the keys. */ AsyncExecutions hvals(ValueStreamingChannel channel, K key); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + AsyncExecutions hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + AsyncExecutions hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + AsyncExecutions hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + AsyncExecutions hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + AsyncExecutions hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + AsyncExecutions hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + AsyncExecutions hpersist(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java index 4d9a3c694b..f2aeaf52b4 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java @@ -19,9 +19,7 @@ */ package io.lettuce.core.cluster.api.sync; -import java.util.List; -import java.util.Map; - +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; @@ -32,6 +30,12 @@ import io.lettuce.core.output.KeyValueStreamingChannel; import io.lettuce.core.output.ValueStreamingChannel; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; +import java.util.List; +import java.util.Map; + /** * Synchronous executed commands on a node selection for Hashes (Key-Value pairs). * @@ -428,4 +432,152 @@ public interface NodeSelectionHashCommands { * @return Long count of the keys. */ Executions hvals(ValueStreamingChannel channel, K key); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Executions hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Executions hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Executions hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Executions hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Executions hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Executions hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + Executions hpersist(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/protocol/CommandType.java b/src/main/java/io/lettuce/core/protocol/CommandType.java index 7a9d87524d..7207a50dab 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandType.java +++ b/src/main/java/io/lettuce/core/protocol/CommandType.java @@ -46,7 +46,7 @@ public enum CommandType implements ProtocolKeyword { // Keys - COPY, DEL, DUMP, EXISTS, EXPIRE, EXPIREAT, EXPIRETIME, KEYS, MIGRATE, MOVE, OBJECT, PERSIST, PEXPIRE, PEXPIREAT, PEXPIRETIME, PTTL, RANDOMKEY, RENAME, RENAMENX, RESTORE, TOUCH, TTL, TYPE, SCAN, UNLINK, + COPY, DEL, DUMP, EXISTS, HEXPIRE, EXPIRE, HEXPIREAT, EXPIREAT, HEXPIRETIME, EXPIRETIME, KEYS, MIGRATE, MOVE, OBJECT, HPERSIST, PERSIST, PEXPIRE, PEXPIREAT, PEXPIRETIME, PTTL, RANDOMKEY, RENAME, RENAMENX, RESTORE, TOUCH, TTL, TYPE, SCAN, UNLINK, // String diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt index 6ab7746601..34a4228f49 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt @@ -20,8 +20,17 @@ package io.lettuce.core.api.coroutines -import io.lettuce.core.* +import io.lettuce.core.ExperimentalLettuceCoroutinesApi +import io.lettuce.core.ExpireArgs import kotlinx.coroutines.flow.Flow +import io.lettuce.core.KeyScanCursor +import io.lettuce.core.KeyValue +import io.lettuce.core.MapScanCursor +import io.lettuce.core.ScanArgs +import io.lettuce.core.ScanCursor +import java.time.Duration +import java.time.Instant +import java.util.* /** * Coroutine executed commands for Hashes (Key-Value pairs). @@ -298,5 +307,153 @@ interface RedisHashCoroutinesCommands { */ fun hvals(key: K): Flow + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set. + * @since 7.0 + */ + suspend fun hexpire(key: K, seconds: Long, vararg fields: K): Boolean? + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set. + * @since 7.0 + */ + suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL [Duration] + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set. + * @since 7.0 + */ + suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL [Duration] + * @param expireArgs the [ExpireArgs]. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set. + * @since 7.0 + */ + suspend fun hexpire(key: K, seconds: Duration, expireArgs: ExpireArgs, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Date, expireArgs: ExpireArgs, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): Boolean? + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not + * exist or the timeout could not be set (see: `EXPIRE`). + * @since 7.0 + */ + suspend fun hexpireat(key: K, timestamp: Instant, expireArgs: ExpireArgs, vararg fields: K): Boolean? + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns `-1` if + * the key exists but has no associated expiration time. The command returns `-2` if the key does not exist. + * @since 7.0 + */ + suspend fun hexpiretime(key: K, vararg fields: K): Long? + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * `true` if the timeout was removed. `false` if `key` does not exist or does not have an + * associated timeout. + */ + suspend fun hpersist(key: K, vararg fields: K): Boolean? + } diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt index ec1a488735..8a1d959e54 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt @@ -26,6 +26,9 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.toList import kotlinx.coroutines.reactive.asFlow import kotlinx.coroutines.reactive.awaitFirstOrNull +import java.time.Duration +import java.time.Instant +import java.util.* /** @@ -113,5 +116,60 @@ internal class RedisHashCoroutinesCommandsImpl(internal val op override fun hvals(key: K): Flow = ops.hvals(key).asFlow() + override suspend fun hexpire(key: K, seconds: Long, vararg fields: K): Boolean? = + ops.hexpire(key, seconds, *fields).awaitFirstOrNull() + + override suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? = + ops.hexpire(key, seconds, expireArgs, *fields).awaitFirstOrNull() + + override suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): Boolean? = + ops.hexpire(key, seconds, *fields).awaitFirstOrNull() + + override suspend fun hexpire( + key: K, + seconds: Duration, + expireArgs: ExpireArgs, + vararg fields: K + ): Boolean? = + ops.hexpire(key, seconds, expireArgs, *fields).awaitFirstOrNull() + + override suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): Boolean? = + ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + + override suspend fun hexpireat( + key: K, + timestamp: Long, + expireArgs: ExpireArgs, + vararg fields: K + ): Boolean? = + ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + + override suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): Boolean? = + ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + + override suspend fun hexpireat( + key: K, + timestamp: Instant, + expireArgs: ExpireArgs, + vararg fields: K + ): Boolean? = + ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + + override suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): Boolean? = + ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + + override suspend fun hexpireat( + key: K, + timestamp: Date, + expireArgs: ExpireArgs, + vararg fields: K + ): Boolean? = + ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + + override suspend fun hexpiretime(key: K, vararg fields: K): Long? = + ops.hexpiretime(key).awaitFirstOrNull() + + override suspend fun hpersist(key: K, vararg fields: K): Boolean? = ops.hpersist(key).awaitFirstOrNull() + } diff --git a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java index ddef1ce24f..96dfe525eb 100644 --- a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java @@ -428,4 +428,151 @@ public interface RedisHashCommands { */ Long hvals(ValueStreamingChannel channel, K key); + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, long seconds, K... fields); + + /** + * Set the time to live (in seconds) for one or more fields, belonging to a certain key. + * + * @param key the key of the fields. + * @param seconds the seconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, Duration seconds, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key. + * + * @param key the key. + * @param seconds the TTL {@link Duration} + * @param expireArgs the {@link ExpireArgs}. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set. + * @since 7.0 + */ + Boolean hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. + * + * @param key the key. + * @param timestamp the timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not + * exist or the timeout could not be set (see: {@code EXPIRE}). + * @since 7.0 + */ + Boolean hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields in as unix timestamp in seconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if + * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Long hexpiretime(K key, K... fields); + + /** + * Remove the expiration from one or more fields. + * + * @param key the key. + * @param fields one or more fields to remove the TTL for. + * @return Boolean integer-reply specifically: + * + * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an + * associated timeout. + */ + Boolean hpersist(K key, K... fields); } diff --git a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java index 2b78d3f99c..57eb8d2bbc 100644 --- a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java @@ -1,17 +1,5 @@ package io.lettuce.core; -import static org.assertj.core.api.Assertions.*; - -import java.lang.reflect.Field; -import java.net.SocketAddress; -import java.time.Duration; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.junit.jupiter.api.Test; - import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.event.command.CommandFailedEvent; import io.lettuce.core.event.command.CommandListener; @@ -27,6 +15,17 @@ import io.lettuce.test.resource.TestClientResources; import io.lettuce.test.settings.TestSettings; import io.netty.util.concurrent.EventExecutorGroup; +import org.junit.jupiter.api.Test; + +import java.lang.reflect.Field; +import java.net.SocketAddress; +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for {@link RedisClient}. @@ -138,7 +137,9 @@ void shouldPropagateCommandTimeoutToCommandListener() throws InterruptedExceptio assertThat(commandListener.started).hasSize(1); assertThat(commandListener.succeeded).isEmpty(); - assertThat(commandListener.failed).hasSize(1).extracting(it -> it.getCommand().getType()).contains(CommandType.BLPOP); + + Wait.untilTrue(() -> commandListener.failed.size() == 1); + assertThat(commandListener.failed).extracting(it -> it.getCommand().getType()).contains(CommandType.BLPOP); FastShutdown.shutdown(client); } diff --git a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java index 9d2b676aae..01b5be2241 100644 --- a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java @@ -1,14 +1,14 @@ package io.lettuce.core; -import static org.assertj.core.api.Assertions.*; - -import java.nio.charset.StandardCharsets; - -import org.junit.jupiter.api.Test; - import io.lettuce.core.codec.StringCodec; import io.lettuce.core.protocol.Command; +import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import org.junit.jupiter.api.Test; + +import java.nio.charset.StandardCharsets; + +import static org.assertj.core.api.Assertions.assertThat; /** * Unit tests for {@link RedisCommandBuilder}. @@ -16,6 +16,11 @@ * @author Mark Paluch */ class RedisCommandBuilderUnitTests { + public static final String MY_KEY = "hKey"; + public static final String MY_FIELD1 = "hField1"; + public static final String MY_FIELD2 = "hField2"; + public static final String MY_FIELD3 = "hField3"; + RedisCommandBuilder sut = new RedisCommandBuilder<>(StringCodec.UTF8); @@ -29,4 +34,53 @@ void shouldCorrectlyConstructXreadgroup() { .isEqualTo("stream"); } + @Test + void shouldCorrectlyConstructHexpire() { + + Command command = + sut.hexpire(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*8\r\n" + "$7\r\n" + "HEXPIRE\r\n" + "$4\r\n" + + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHexpireat() { + + Command command = + sut.hexpireat(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*8\r\n" + "$9\r\n" + "HEXPIREAT\r\n" + "$4\r\n" + + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHexpiretime() { + + Command command = sut.hexpiretime(MY_KEY, MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$11\r\n" + "HEXPIRETIME\r\n" + "$4\r\n" + + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHpersist() { + + Command command = sut.hpersist(MY_KEY, MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$8\r\n" + "HPERSIST\r\n" + "$4\r\n" + + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + + "hField3\r\n"); + } } diff --git a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java index e346b29128..b87102505d 100644 --- a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java @@ -19,24 +19,9 @@ */ package io.lettuce.core.commands; -import static org.assertj.core.api.Assertions.*; - -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.inject.Inject; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExtendWith; - -import io.lettuce.core.KeyValue; +import io.lettuce.core.ExpireArgs; import io.lettuce.core.KeyScanCursor; +import io.lettuce.core.KeyValue; import io.lettuce.core.MapScanCursor; import io.lettuce.core.ScanArgs; import io.lettuce.core.ScanCursor; @@ -47,6 +32,26 @@ import io.lettuce.test.LettuceExtension; import io.lettuce.test.ListStreamingAdapter; import io.lettuce.test.condition.EnabledOnCommand; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; + +import javax.inject.Inject; +import java.time.Duration; +import java.time.Instant; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.offset; +import static org.awaitility.Awaitility.await; /** * Integration tests for {@link io.lettuce.core.api.sync.RedisHashCommands}. @@ -58,6 +63,9 @@ @ExtendWith(LettuceExtension.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class HashCommandIntegrationTests extends TestSupport { + public static final String MY_KEY = "hKey"; + public static final String MY_FIELD = "hField"; + public static final String MY_VALUE = "hValue"; private final RedisCommands redis; @@ -71,6 +79,13 @@ void setUp() { this.redis.flushall(); } + @AfterEach + void tearDown() { + // resets the configuration settings to default, would not be needed once listpack is supported + assertThat(redis.configSet("hash-max-listpack-entries","512")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","64")).isEqualTo("OK"); + } + @Test void hdel() { assertThat(redis.hdel(key, "one")).isEqualTo(0); @@ -541,6 +556,81 @@ void hscanNoValuesMatch() { assertThat(cursor.getKeys()).hasSize(11); } + @Test + @EnabledOnCommand("HEXPIRE") + void hexpire() { + // the below settings are required until the solution is able to support listpack entries + // see TODOs in https://github.com/redis/redis/pull/13172 for more details + assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).isTrue(); + + await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); + } + + @Test + @EnabledOnCommand("HEXPIRE") + void hexpireExpireArgs() { + // the below settings are required until the solution is able to support listpack entries + // see TODOs in https://github.com/redis/redis/pull/13172 for more details + assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.nx(), MY_FIELD)).isTrue(); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.xx(), MY_FIELD)).isTrue(); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(10), ExpireArgs.Builder.gt(), MY_FIELD)).isTrue(); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.lt(), MY_FIELD)).isTrue(); + + await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); + } + + @Test + @EnabledOnCommand("HEXPIREAT") + void hexpireat() { + // the below settings are required until the solution is able to support listpack entries + // see TODOs in https://github.com/redis/redis/pull/13172 for more details + assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpireat(MY_KEY,Instant.now().plusSeconds(1) , MY_FIELD)).isTrue(); + + await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); + } + + @Test + @EnabledOnCommand("HEXPIRETIME") + void hexpiretime() { + Date expiration = new Date(System.currentTimeMillis() + 10000); + // the below settings are required until the solution is able to support listpack entries + // see TODOs in https://github.com/redis/redis/pull/13172 for more details + assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpireat(MY_KEY, expiration, MY_FIELD)).isTrue(); + + assertThat(redis.hexpiretime(MY_KEY, MY_FIELD)).isEqualTo(expiration.getTime() / 1000); + } + + @Test + @EnabledOnCommand("HPERSIST") + void persist() { + // the below settings are required until the solution is able to support listpack entries + // see TODOs in https://github.com/redis/redis/pull/13172 for more details + assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isFalse(); + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isFalse(); + assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).isTrue(); + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isTrue(); + } + void setup100KeyValues(Map expect) { for (int i = 0; i < 100; i++) { expect.put(key + i, value + 1); From 978176927ae74f373ba8c0eb3a76230db7cf23bd Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Tue, 30 Apr 2024 18:57:10 +0300 Subject: [PATCH 07/28] MAke sure we wait for the check so it does not fail on the slower pipeline (#2844) --- .../java/io/lettuce/core/RedisClientIntegrationTests.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java index 57eb8d2bbc..22a8671745 100644 --- a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java @@ -139,7 +139,10 @@ void shouldPropagateCommandTimeoutToCommandListener() throws InterruptedExceptio assertThat(commandListener.succeeded).isEmpty(); Wait.untilTrue(() -> commandListener.failed.size() == 1); - assertThat(commandListener.failed).extracting(it -> it.getCommand().getType()).contains(CommandType.BLPOP); + Wait.untilTrue(() -> + commandListener.failed.stream().anyMatch(command -> + command.getCommand().getType().equals(CommandType.BLPOP))); + FastShutdown.shutdown(client); } From 53050ea3cdd3db6e501d063cc9a0653784057e29 Mon Sep 17 00:00:00 2001 From: atakavci <58048133+atakavci@users.noreply.github.com> Date: Thu, 2 May 2024 09:51:47 +0300 Subject: [PATCH 08/28] Add support for `SPUBLISH` (#2838) * implementation of SPUBLISH * sort methods by name * test cluster spublish with no redirects * use injected cluster client in RedisClusterPubSubConnectionIntegrationTests --- .../core/AbstractRedisAsyncCommands.java | 7 +- .../core/AbstractRedisReactiveCommands.java | 5 + .../io/lettuce/core/RedisCommandBuilder.java | 7 ++ .../api/async/BaseRedisAsyncCommands.java | 10 ++ .../reactive/BaseRedisReactiveCommands.java | 10 ++ .../core/api/sync/BaseRedisCommands.java | 10 ++ .../ClusterPubSubConnectionProvider.java | 5 + .../core/cluster/PubSubClusterEndpoint.java | 9 ++ .../async/BaseNodeSelectionAsyncCommands.java | 10 ++ .../api/sync/BaseNodeSelectionCommands.java | 10 ++ .../pubsub/RedisClusterPubSubAdapter.java | 5 + .../pubsub/RedisClusterPubSubListener.java | 12 +++ .../io/lettuce/core/protocol/CommandType.java | 2 +- .../core/pubsub/PubSubCommandBuilder.java | 21 +++-- .../lettuce/core/pubsub/PubSubEndpoint.java | 3 + .../io/lettuce/core/pubsub/PubSubOutput.java | 3 +- .../core/pubsub/RedisPubSubAdapter.java | 5 + .../pubsub/RedisPubSubAsyncCommandsImpl.java | 5 + .../core/pubsub/RedisPubSubListener.java | 11 +++ .../RedisPubSubReactiveCommandsImpl.java | 5 + .../coroutines/BaseRedisCoroutinesCommands.kt | 10 ++ .../BaseRedisCoroutinesCommandsImpl.kt | 2 + .../lettuce/core/api/BaseRedisCommands.java | 10 ++ ...usterPubSubConnectionIntegrationTests.java | 94 +++++++++++++++++-- .../core/pubsub/PubSubCommandTest.java | 52 +++++++--- .../core/pubsub/PubSubReactiveTest.java | 41 ++++---- .../core/support/PubSubTestListener.java | 12 +++ 27 files changed, 326 insertions(+), 50 deletions(-) diff --git a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java index 8b09c6b2e2..9a37545f49 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java @@ -1295,7 +1295,7 @@ public RedisFuture hscan(KeyValueStreamingChannel channe @Override public RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, - ScanArgs scanArgs) { + ScanArgs scanArgs) { return dispatch(commandBuilder.hscanNoValuesStreaming(channel, key, scanCursor, scanArgs)); } @@ -2069,6 +2069,11 @@ public RedisFuture> spop(K key, long count) { return dispatch(commandBuilder.spop(key, count)); } + @Override + public RedisFuture spublish(K shardChannel, V message) { + return dispatch(commandBuilder.spublish(shardChannel, message)); + } + @Override public RedisFuture srandmember(K key) { return dispatch(commandBuilder.srandmember(key)); diff --git a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java index 47006ac03d..c0bfab6ab5 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java @@ -2147,6 +2147,11 @@ public Flux spop(K key, long count) { return createDissolvingFlux(() -> commandBuilder.spop(key, count)); } + @Override + public Mono spublish(K shardChannel, V message) { + return createMono(() -> commandBuilder.spublish(shardChannel, message)); + } + @Override public Mono srandmember(K key) { return createMono(() -> commandBuilder.srandmember(key)); diff --git a/src/main/java/io/lettuce/core/RedisCommandBuilder.java b/src/main/java/io/lettuce/core/RedisCommandBuilder.java index 143fc6cd89..9c69d01912 100644 --- a/src/main/java/io/lettuce/core/RedisCommandBuilder.java +++ b/src/main/java/io/lettuce/core/RedisCommandBuilder.java @@ -2754,6 +2754,13 @@ Command> spop(K key, long count) { return createCommand(SPOP, new ValueSetOutput<>(codec), args); } + Command spublish(K shardChannel, V message) { + LettuceAssert.notNull(shardChannel, "ShardChannel " + MUST_NOT_BE_NULL); + + CommandArgs args = new CommandArgs<>(codec).addKey(shardChannel).addValue(message); + return createCommand(SPUBLISH, new IntegerOutput<>(codec), args); + } + Command srandmember(K key) { notNullKey(key); diff --git a/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java index c4eb965a80..76aac4f8ea 100644 --- a/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java @@ -102,6 +102,16 @@ public interface BaseRedisAsyncCommands { */ RedisFuture pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + RedisFuture spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java index 051340ea99..24d9989efa 100644 --- a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java @@ -102,6 +102,16 @@ public interface BaseRedisReactiveCommands { */ Mono pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + Mono spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java index b0ebe918be..ce942334ed 100644 --- a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java @@ -101,6 +101,16 @@ public interface BaseRedisCommands { */ Long pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + Long spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java b/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java index ce5abb67e0..747018ca60 100644 --- a/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java +++ b/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java @@ -167,6 +167,11 @@ public void punsubscribed(K pattern, long count) { notifications.punsubscribed(getNode(), pattern, count); } + @Override + public void smessage(K shardChannel, V message) { + notifications.smessage(getNode(), shardChannel, message); + } + @Override public void ssubscribed(K channel, long count) { notifications.ssubscribed(getNode(), channel, count); diff --git a/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java b/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java index 5679e04c8c..9288dd8f85 100644 --- a/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java +++ b/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java @@ -88,6 +88,9 @@ protected void notifyListeners(PubSubMessage output) { case unsubscribe: multicast.unsubscribed(clusterNode, output.channel(), output.count()); break; + case smessage: + multicast.smessage(clusterNode, output.channel(), output.body()); + break; case ssubscribe: multicast.ssubscribed(clusterNode, output.channel(), output.count()); break; @@ -192,6 +195,12 @@ public void punsubscribed(RedisClusterNode node, K pattern, long count) { clusterListeners.forEach(listener -> listener.punsubscribed(node, pattern, count)); } + @Override + public void smessage(RedisClusterNode node, K shardChannel, V message) { + getListeners().forEach(listener -> listener.smessage(shardChannel, message)); + clusterListeners.forEach(listener -> listener.smessage(node, shardChannel, message)); + } + @Override public void ssubscribed(RedisClusterNode node, K channel, long count) { getListeners().forEach(listener -> listener.ssubscribed(channel, count)); diff --git a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java index 059ddfba48..dbdc2744f4 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java @@ -102,6 +102,16 @@ public interface BaseNodeSelectionAsyncCommands { */ AsyncExecutions pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + AsyncExecutions spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java index e9072268d4..a1b8922c8d 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java @@ -97,6 +97,16 @@ public interface BaseNodeSelectionCommands { */ Executions pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + Executions spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java index c38e672ee3..554efa3009 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java @@ -42,6 +42,11 @@ public void punsubscribed(RedisClusterNode node, K pattern, long count) { // empty adapter method } + @Override + public void smessage(RedisClusterNode node, K shardChannel, V message) { + // empty adapter method + } + @Override public void ssubscribed(RedisClusterNode node, K channel, long count) { // empty adapter method diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java index 650dc233ca..482453df7c 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java @@ -67,6 +67,18 @@ public interface RedisClusterPubSubListener { */ void punsubscribed(RedisClusterNode node, K pattern, long count); + /** + * Message received from a shard channel subscription. + * + * @param node the {@link RedisClusterNode} from which the {@code message} originates. + * @param shardChannel shard channel. + * @param message Message. + * @since 7.0 + */ + default void smessage(RedisClusterNode node, K shardChannel, V message){ + message(node, shardChannel, message); + } + /** * Subscribed to a shard channel. * diff --git a/src/main/java/io/lettuce/core/protocol/CommandType.java b/src/main/java/io/lettuce/core/protocol/CommandType.java index 7207a50dab..da1f6499c8 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandType.java +++ b/src/main/java/io/lettuce/core/protocol/CommandType.java @@ -74,7 +74,7 @@ public enum CommandType implements ProtocolKeyword { // Pub/Sub - PSUBSCRIBE, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, UNSUBSCRIBE, PUBSUB, SSUBSCRIBE, + PSUBSCRIBE, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, UNSUBSCRIBE, PUBSUB, SSUBSCRIBE, SPUBLISH, // Sets diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java index c733435cbc..8c486770ec 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java @@ -98,6 +98,19 @@ final Command punsubscribe(K... patterns) { return pubSubCommand(PUNSUBSCRIBE, new PubSubOutput<>(codec), patterns); } + Command spublish(K shardChannel, V message) { + CommandArgs args = new CommandArgs<>(codec).addKey(shardChannel).addValue(message); + return createCommand(SPUBLISH, new IntegerOutput<>(codec), args); + } + + @SafeVarargs + final Command ssubscribe(K... shardChannels) { + LettuceAssert.notEmpty(shardChannels, "Shard channels " + MUST_NOT_BE_EMPTY); + + CommandArgs args = new CommandArgs<>(codec).addKeys(shardChannels); + return createCommand(SSUBSCRIBE, new PubSubOutput<>(codec), args); + } + @SafeVarargs final Command subscribe(K... channels) { LettuceAssert.notEmpty(channels, "Channels " + MUST_NOT_BE_EMPTY); @@ -110,14 +123,6 @@ final Command unsubscribe(K... channels) { return pubSubCommand(UNSUBSCRIBE, new PubSubOutput<>(codec), channels); } - @SafeVarargs - final Command ssubscribe(K... shardChannels) { - LettuceAssert.notEmpty(shardChannels, "Shard channels " + MUST_NOT_BE_EMPTY); - - CommandArgs args = new CommandArgs<>(codec).addKeys(shardChannels); - return createCommand(SSUBSCRIBE, new PubSubOutput<>(codec), args); - } - @SafeVarargs final Command pubSubCommand(CommandType type, CommandOutput output, K... keys) { return new Command<>(type, output, new PubSubCommandArgs<>(codec).addKeys(keys)); diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java b/src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java index febb31f2c0..6b6b267fe2 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubEndpoint.java @@ -263,6 +263,9 @@ protected void notifyListeners(PubSubMessage message) { case unsubscribe: listener.unsubscribed(message.channel(), message.count()); break; + case smessage: + listener.smessage(message.channel(), message.body()); + break; case ssubscribe: listener.ssubscribed(message.channel(), message.count()); break; diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java b/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java index 1bcb61b7a2..18c19ccddb 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java @@ -38,7 +38,7 @@ public class PubSubOutput extends CommandOutput implements PubSub public enum Type { - message, pmessage, psubscribe, punsubscribe, subscribe, unsubscribe, ssubscribe; + message, pmessage, psubscribe, punsubscribe, subscribe, unsubscribe, ssubscribe, smessage; private final static Set names = new HashSet<>(); @@ -108,6 +108,7 @@ private void handleOutput(ByteBuffer bytes) { pattern = codec.decodeKey(bytes); break; } + case smessage: case message: if (channel == null) { channel = codec.decodeKey(bytes); diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java index ef16fed6fb..828a85743f 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java @@ -59,6 +59,11 @@ public void punsubscribed(K pattern, long count) { // empty adapter method } + @Override + public void smessage(K shardChannel, V message) { + // empty adapter method + } + @Override public void ssubscribed(K shardChannel, long count) { // empty adapter method diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java index f69f24fbba..20515e60fd 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java @@ -100,6 +100,11 @@ public RedisFuture> pubsubShardNumsub(K... shardChannels) { return dispatch(commandBuilder.pubsubShardNumsub(shardChannels)); } + @Override + public RedisFuture spublish(K shardChannel, V message) { + return dispatch(commandBuilder.spublish(shardChannel, message)); + } + @Override @SuppressWarnings("unchecked") public RedisFuture ssubscribe(K... channels) { diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java index 71b5a6ad13..ccc1f0e1e1 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java @@ -88,4 +88,15 @@ default void ssubscribed(K shardChannel, long count) { subscribed(shardChannel, count); } + /** + * Message received from a shard channel subscription. + * + * @param shardChannel shard channel. + * @param message Message. + * @since 7.0 + */ + default void smessage(K shardChannel, V message) { + message(shardChannel, message); + } + } diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java index 218fbe9c77..adff1b58fa 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java @@ -159,6 +159,11 @@ public Mono> pubsubShardNumsub(K... shardChannels) { return createMono(() -> commandBuilder.pubsubShardNumsub(shardChannels)); } + @Override + public Mono spublish(K shardChannel, V message) { + return createMono(() -> commandBuilder.publish(shardChannel, message)); + } + @Override public Mono ssubscribe(K... shardChannels) { return createFlux(() -> commandBuilder.ssubscribe(shardChannels)).then(); diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommands.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommands.kt index 37ba6c789f..df829da7b5 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommands.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommands.kt @@ -102,6 +102,16 @@ interface BaseRedisCoroutinesCommands { */ suspend fun pubsubNumpat(): Long + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + suspend fun spublish(shardChannel: K, message: V): Long? + /** * Echo the given string. * diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommandsImpl.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommandsImpl.kt index 910fae9317..6351169241 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommandsImpl.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/BaseRedisCoroutinesCommandsImpl.kt @@ -60,6 +60,8 @@ internal class BaseRedisCoroutinesCommandsImpl(internal val op override suspend fun pubsubNumpat(): Long = ops.pubsubNumpat().awaitSingle() + override suspend fun spublish(shardChannel: K, message: V): Long? = ops.spublish(shardChannel, message).awaitFirstOrNull() + override suspend fun echo(msg: V): V = ops.echo(msg).awaitSingle() override suspend fun role(): List = ops.role().asFlow().toList() diff --git a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java index 40d5165f16..27c5723f0f 100644 --- a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java +++ b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java @@ -102,6 +102,16 @@ public interface BaseRedisCommands { */ Long pubsubNumpat(); + /** + * Post a message to a shard channel. + * + * @param shardChannel the shard channel type: key. + * @param message the message type: value. + * @return Long integer-reply the number of clients that received the message. + * @since 7.0 + */ + Long spublish(K shardChannel, V message); + /** * Echo the given string. * diff --git a/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java index c4a808fad9..772af41dab 100644 --- a/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java @@ -17,11 +17,13 @@ import io.lettuce.core.RedisURI; import io.lettuce.core.TestSupport; import io.lettuce.core.api.sync.RedisCommands; +import io.lettuce.core.cluster.ClusterClientOptions; import io.lettuce.core.cluster.RedisClusterClient; import io.lettuce.core.cluster.api.StatefulRedisClusterConnection; import io.lettuce.core.cluster.models.partitions.RedisClusterNode; import io.lettuce.core.cluster.pubsub.api.async.NodeSelectionPubSubAsyncCommands; import io.lettuce.core.cluster.pubsub.api.async.PubSubAsyncNodeSelection; +import io.lettuce.core.cluster.pubsub.api.async.RedisClusterPubSubAsyncCommands; import io.lettuce.core.cluster.pubsub.api.reactive.NodeSelectionPubSubReactiveCommands; import io.lettuce.core.cluster.pubsub.api.reactive.PubSubReactiveNodeSelection; import io.lettuce.core.cluster.pubsub.api.sync.NodeSelectionPubSubCommands; @@ -45,6 +47,8 @@ class RedisClusterPubSubConnectionIntegrationTests extends TestSupport { private final RedisClusterClient clusterClient; + private final RedisClusterClient clusterClientWithNoRedirects; + private final PubSubTestListener connectionListener = new PubSubTestListener(); private final PubSubTestListener nodeListener = new PubSubTestListener(); @@ -57,9 +61,16 @@ class RedisClusterPubSubConnectionIntegrationTests extends TestSupport { String shardChannel = "shard-channel"; + String shardMessage = "shard msg!"; + + String shardTestChannel = "shard-test-channel"; + @Inject - RedisClusterPubSubConnectionIntegrationTests(RedisClusterClient clusterClient) { + RedisClusterPubSubConnectionIntegrationTests(RedisClusterClient clusterClient, RedisClusterClient clusterClient2) { this.clusterClient = clusterClient; + ClusterClientOptions.Builder builder = ClusterClientOptions.builder().maxRedirects(0); + clusterClient2.setOptions(builder.build()); + this.clusterClientWithNoRedirects = clusterClient2; } @BeforeEach @@ -94,15 +105,16 @@ void testRegularClientPubSubChannels() { } @Test + @EnabledOnCommand("SSUBSCRIBE") void testRegularClientPubSubShardChannels() { pubSubConnection.sync().ssubscribe(shardChannel); Integer clusterKeyslot = connection.sync().clusterKeyslot(shardChannel).intValue(); - RedisCommands rightSlot = - connection.sync().nodes(node -> node.getSlots().contains(clusterKeyslot)).commands(0); - RedisCommands wrongSlot = - connection.sync().nodes(node -> !node.getSlots().contains(clusterKeyslot)).commands(0); + RedisCommands rightSlot = connection.sync().nodes(node -> node.getSlots().contains(clusterKeyslot)) + .commands(0); + RedisCommands wrongSlot = connection.sync().nodes(node -> !node.getSlots().contains(clusterKeyslot)) + .commands(0); List channelsOnSubscribedNode = rightSlot.pubsubShardChannels(); assertThat(channelsOnSubscribedNode).hasSize(1); @@ -113,7 +125,7 @@ void testRegularClientPubSubShardChannels() { @Test @EnabledOnCommand("SSUBSCRIBE") - void subscribeToShardChannel(){ + void subscribeToShardChannel() { pubSubConnection.sync().ssubscribe(shardChannel); Wait.untilEquals(1L, connectionListener.getShardCounts()::poll).waitOrTimeout(); @@ -126,13 +138,79 @@ void subscribeToShardChannelViaReplica() { int clusterKeyslot = connection.sync().clusterKeyslot(shardChannel).intValue(); String thisNode = connection.getPartitions().getPartitionBySlot(clusterKeyslot).getNodeId(); - RedisPubSubAsyncCommands replica = - pubSubConnection.async().nodes(node -> thisNode.equals(node.getSlaveOf())).commands(0); + RedisPubSubAsyncCommands replica = pubSubConnection.async() + .nodes(node -> thisNode.equals(node.getSlaveOf())).commands(0); replica.ssubscribe(shardChannel); Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); } + @Test + @EnabledOnCommand("SSUBSCRIBE") + void publishToShardChannel() throws Exception { + pubSubConnection.addListener(connectionListener); + pubSubConnection.async().ssubscribe(shardChannel); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + + pubSubConnection.async().spublish(shardChannel, shardMessage); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + } + + @Test + @EnabledOnCommand("SSUBSCRIBE") + void publishToShardChannelViaDifferentEndpoints() throws Exception { + pubSubConnection.addListener(connectionListener); + pubSubConnection.async().ssubscribe(shardChannel); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + + pubSubConnection.async().ssubscribe(shardTestChannel); + Wait.untilEquals(shardTestChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + + pubSubConnection.async().spublish(shardChannel, shardMessage); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + + pubSubConnection.async().spublish(shardTestChannel, shardMessage); + Wait.untilEquals(shardTestChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + } + + @Test + @EnabledOnCommand("SSUBSCRIBE") + void publishToShardChannelViaNewClient() throws Exception { + pubSubConnection.addListener(connectionListener); + pubSubConnection.async().ssubscribe(shardChannel); + + StatefulRedisClusterPubSubConnection newPubsub = clusterClientWithNoRedirects.connectPubSub(); + newPubsub.async().spublish(shardChannel, shardMessage); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + newPubsub.close(); + } + + @Test + @EnabledOnCommand("SSUBSCRIBE") + void publishToShardChannelViaNewClientWithNoRedirects() throws Exception { + pubSubConnection.addListener(connectionListener); + pubSubConnection.async().ssubscribe(shardChannel); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + + pubSubConnection.async().ssubscribe(shardTestChannel); + Wait.untilEquals(shardTestChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + + RedisClusterPubSubAsyncCommands cmd = clusterClientWithNoRedirects.connectPubSub().async(); + + cmd.spublish(shardChannel, shardMessage); + Wait.untilEquals(shardChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + + cmd.spublish(shardTestChannel, shardMessage); + Wait.untilEquals(shardTestChannel, connectionListener.getShardChannels()::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, connectionListener.getMessages()::poll).waitOrTimeout(); + cmd.getStatefulConnection().close(); + } + @Test void myIdWorksAfterDisconnect() throws InterruptedException { diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubCommandTest.java b/src/test/java/io/lettuce/core/pubsub/PubSubCommandTest.java index 5fe358def3..c6fd838050 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubCommandTest.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubCommandTest.java @@ -32,6 +32,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.assertj.core.util.Arrays; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -53,6 +54,7 @@ import io.lettuce.test.Wait; import io.lettuce.test.WithPassword; import io.lettuce.test.condition.EnabledOnCommand; +import io.lettuce.test.resource.DefaultRedisClient; import io.lettuce.test.resource.FastShutdown; import io.lettuce.test.resource.TestClientResources; @@ -74,6 +76,8 @@ class PubSubCommandTest extends AbstractRedisClientTest { BlockingQueue channels = listener.getChannels(); + BlockingQueue shardChannels = listener.getShardChannels(); + BlockingQueue patterns = listener.getPatterns(); BlockingQueue messages = listener.getMessages(); @@ -88,6 +92,8 @@ class PubSubCommandTest extends AbstractRedisClientTest { String message = "msg!"; + String shardMessage = "shard msg!"; + @BeforeEach void openPubSubConnection() { try { @@ -221,6 +227,29 @@ void message() throws Exception { assertThat(messages.take()).isEqualTo(message); } + @Test + @EnabledOnCommand("SSUBSCRIBE") + void messageToShardChannel() throws Exception { + pubsub.ssubscribe(shardChannel); + Wait.untilEquals(shardChannel, shardChannels::poll).waitOrTimeout(); + + redis.spublish(shardChannel, shardMessage); + Wait.untilEquals(shardChannel, shardChannels::poll).waitOrTimeout(); + Wait.untilEquals(shardMessage, messages::poll).waitOrTimeout(); + } + + @Test + @EnabledOnCommand("SSUBSCRIBE") + void messageToShardChannelViaNewClient() throws Exception { + pubsub.ssubscribe(shardChannel); + Wait.untilEquals(shardChannel, shardChannels::poll).waitOrTimeout(); + + RedisPubSubAsyncCommands redis = DefaultRedisClient.get().connectPubSub().async(); + redis.spublish(shardChannel, shardMessage); + Wait.untilEquals(shardMessage, messages::poll).waitOrTimeout(); + Wait.untilEquals(shardChannel, shardChannels::poll).waitOrTimeout(); + } + @Test @EnabledOnCommand("ACL") void messageAsPushMessage() throws Exception { @@ -362,40 +391,35 @@ void pubsubNumsub() { @Test @EnabledOnCommand("SPUBLISH") void pubsubShardChannels() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // TestFutures.awaitOrTimeout(pubsub.ssubscribe(channel)); + TestFutures.awaitOrTimeout(pubsub.ssubscribe(shardChannel)); List result = redis.pubsubShardChannels(); - // assertThat(result).contains(channel); + assertThat(result).contains(shardChannel); } @Test @EnabledOnCommand("SPUBLISH") void pubsubMultipleShardChannels() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // TestFutures.awaitOrTimeout(pubsub.ssubscribe(channel, "channel1", "channel3")); + TestFutures.awaitOrTimeout(pubsub.ssubscribe(shardChannel, "channel1", "channel3")); List result = redis.pubsubShardChannels(); - // assertThat(result).contains(channel, "channel1", "channel3"); + assertThat(result).contains(shardChannel, "channel1", "channel3"); } @Test @EnabledOnCommand("SPUBLISH") void pubsubShardChannelsWithArg() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // TestFutures.awaitOrTimeout(pubsub.ssubscribe(channel)); - List result = redis.pubsubShardChannels(pattern); - // assertThat(result).contains(channel); + TestFutures.awaitOrTimeout(pubsub.ssubscribe(shardChannel)); + List result = redis.pubsubShardChannels(shardChannel); + assertThat(result).contains(shardChannel); } @Test @EnabledOnCommand("SPUBLISH") void pubsubShardNumsub() { - // TODO After we have SSUBSCRIBE implement a step to subscribe to a shard channel - // Depends on https://github.com/lettuce-io/lettuce-core/issues/2758 + TestFutures.awaitOrTimeout(pubsub.ssubscribe(shardChannel)); Map result = redis.pubsubShardNumsub(shardChannel); - assertThat(result.getOrDefault(shardChannel, 0L)).isEqualTo(0); - // TODO verify that the channel from step 1 is the one returned by the command + assertThat(result.keySet()).contains(shardChannel); } @Test diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java index 86a96a2562..2c93374fa9 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java @@ -56,17 +56,25 @@ class PubSubReactiveTest extends AbstractRedisClientTest implements RedisPubSubListener { private RedisPubSubReactiveCommands pubsub; + private RedisPubSubReactiveCommands pubsub2; private BlockingQueue channels; + private BlockingQueue shardChannels; + private BlockingQueue patterns; + private BlockingQueue messages; + private BlockingQueue counts; private String shardChannel = "shard-channel"; + private String channel = "channel0"; + private String pattern = "channel*"; + private String message = "msg!"; @BeforeEach @@ -262,45 +270,40 @@ void pubsubNumsub() { @Test @EnabledOnCommand("SPUBLISH") void pubsubShardChannels() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // block(pubsub.ssubscribe(channel)); + block(pubsub.ssubscribe(shardChannel)); List result = block(pubsub2.pubsubShardChannels().collectList()); - // assertThat(result).contains(channel); + assertThat(result).contains(shardChannel); } @Test @EnabledOnCommand("SPUBLISH") void pubsubShardMultipleChannels() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // StepVerifier.create(pubsub.ssubscribe(channel, "channel1", "channel3")).verifyComplete(); + StepVerifier.create(pubsub.ssubscribe(shardChannel, "channel1", "channel3")).verifyComplete(); - // StepVerifier.create(pubsub2.pubsubShardChannels().collectList()) - // .consumeNextWith(actual -> assertThat(actual).contains(channel, "channel1", "channel3")).verifyComplete(); + StepVerifier.create(pubsub2.pubsubShardChannels().collectList()) + .consumeNextWith(actual -> assertThat(actual).contains(shardChannel, "channel1", "channel3")).verifyComplete(); } @Test @EnabledOnCommand("SPUBLISH") void pubsubShardChannelsWithArg() { - /// TODO : uncomment after SSUBSCRIBE is implemented - // StepVerifier.create(pubsub.ssubscribe(channel)).verifyComplete(); - // Wait.untilTrue(() -> mono(pubsub2.pubsubShardChannels(pattern).filter(s -> channel.equals(s))) != null).waitOrTimeout(); + StepVerifier.create(pubsub.ssubscribe(shardChannel)).verifyComplete(); + Wait.untilTrue(() -> mono(pubsub2.pubsubShardChannels(shardChannel).filter(s -> shardChannel.equals(s))) != null) + .waitOrTimeout(); - String result = mono(pubsub2.pubsubShardChannels(pattern).filter(s -> channel.equals(s))); - // assertThat(result).isEqualToIgnoringCase(channel); + String result = mono(pubsub2.pubsubShardChannels(shardChannel).filter(s -> shardChannel.equals(s))); + assertThat(result).isEqualToIgnoringCase(shardChannel); } @Test @EnabledOnCommand("SPUBLISH") void pubsubShardNumsub() { - - // TODO After we have SSUBSCRIBE implement a step to subscribe to a shard channel - // Depends on https://github.com/lettuce-io/lettuce-core/issues/2758 + StepVerifier.create(pubsub.ssubscribe(shardChannel)).verifyComplete(); Wait.untilEquals(1, () -> block(pubsub2.pubsubShardNumsub(shardChannel)).size()).waitOrTimeout(); Map result = block(pubsub2.pubsubShardNumsub(shardChannel)); - assertThat(result.getOrDefault(shardChannel, 0L)).isEqualTo(0); - // TODO verify that the channel from step 1 is the one returned by the command + assertThat(result.getOrDefault(shardChannel, 0L)).isEqualTo(1); } @Test @@ -314,6 +317,7 @@ void pubsubNumpat() { Long result = block(pubsub2.pubsubNumpat()); assertThat(result.longValue()).isGreaterThan(0); } + @Test void punsubscribe() throws Exception { @@ -420,6 +424,7 @@ void adapter() throws Exception { final BlockingQueue localCounts = LettuceFactories.newBlockingQueue(); RedisPubSubAdapter adapter = new RedisPubSubAdapter() { + @Override public void subscribed(String channel, long count) { super.subscribed(channel, count); @@ -431,6 +436,7 @@ public void unsubscribed(String channel, long count) { super.unsubscribed(channel, count); localCounts.add(count); } + }; pubsub.getStatefulConnection().addListener(adapter); @@ -519,4 +525,5 @@ T mono(Flux flux) { List all(Flux flux) { return flux.collectList().block(); } + } diff --git a/src/test/java/io/lettuce/core/support/PubSubTestListener.java b/src/test/java/io/lettuce/core/support/PubSubTestListener.java index d89c9a7810..1afcb42766 100644 --- a/src/test/java/io/lettuce/core/support/PubSubTestListener.java +++ b/src/test/java/io/lettuce/core/support/PubSubTestListener.java @@ -30,10 +30,15 @@ public class PubSubTestListener implements RedisPubSubListener { private BlockingQueue channels = LettuceFactories.newBlockingQueue(); + private BlockingQueue patterns = LettuceFactories.newBlockingQueue(); + private BlockingQueue messages = LettuceFactories.newBlockingQueue(); + private BlockingQueue counts = LettuceFactories.newBlockingQueue(); + private BlockingQueue shardChannels = LettuceFactories.newBlockingQueue(); + private BlockingQueue shardCounts = LettuceFactories.newBlockingQueue(); // RedisPubSubListener implementation @@ -51,6 +56,12 @@ public void message(String pattern, String channel, String message) { messages.add(message); } + @Override + public void smessage(String channel, String message) { + shardChannels.add(channel); + messages.add(message); + } + @Override public void subscribed(String channel, long count) { channels.add(channel); @@ -116,4 +127,5 @@ public void clear() { counts.clear(); shardCounts.clear(); } + } From e8ae9142311f67c8de3c3e77fa510b8e22124ea3 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Thu, 2 May 2024 10:31:18 +0300 Subject: [PATCH 09/28] Applying code formatter each time we run a Maven build (#2841) * Let's try this again * Add tests and templates * Merge formatting issues + formatter using wrong configuration --- pom.xml | 21 ++ .../io/lettuce/core/AbstractRedisClient.java | 5 +- .../core/AbstractRedisReactiveCommands.java | 4 +- .../io/lettuce/core/ChannelGroupListener.java | 1 + .../java/io/lettuce/core/ClientOptions.java | 11 +- src/main/java/io/lettuce/core/CopyArgs.java | 124 ++++++------ src/main/java/io/lettuce/core/FlushMode.java | 1 + src/main/java/io/lettuce/core/GeoArgs.java | 1 + src/main/java/io/lettuce/core/KillArgs.java | 5 +- src/main/java/io/lettuce/core/LMoveArgs.java | 2 + .../java/io/lettuce/core/MigrateArgs.java | 4 +- src/main/java/io/lettuce/core/Range.java | 1 - .../java/io/lettuce/core/ReadFromImpl.java | 1 + .../io/lettuce/core/RedisChannelWriter.java | 4 +- .../java/io/lettuce/core/RedisClient.java | 30 +-- .../io/lettuce/core/RedisCommandBuilder.java | 2 +- .../java/io/lettuce/core/RedisHandshake.java | 6 +- .../java/io/lettuce/core/RedisPublisher.java | 3 +- .../java/io/lettuce/core/RestoreArgs.java | 5 +- .../java/io/lettuce/core/ScanIterator.java | 6 +- src/main/java/io/lettuce/core/ScanStream.java | 3 +- src/main/java/io/lettuce/core/SetArgs.java | 4 +- .../java/io/lettuce/core/ShutdownArgs.java | 1 + .../java/io/lettuce/core/StrAlgoArgs.java | 4 +- .../java/io/lettuce/core/XAutoClaimArgs.java | 1 + src/main/java/io/lettuce/core/XTrimArgs.java | 5 +- .../lettuce/core/api/StatefulConnection.java | 4 +- .../core/api/async/RedisAclAsyncCommands.java | 9 +- .../core/api/async/RedisGeoAsyncCommands.java | 27 ++- .../core/api/async/RedisHLLAsyncCommands.java | 1 + .../api/async/RedisHashAsyncCommands.java | 7 +- .../async/RedisScriptingAsyncCommands.java | 1 + .../core/api/async/RedisSetAsyncCommands.java | 1 + .../async/RedisSortedSetAsyncCommands.java | 53 +++-- .../api/async/RedisStreamAsyncCommands.java | 1 + .../api/async/RedisStringAsyncCommands.java | 1 + .../RedisTransactionalAsyncCommands.java | 1 + .../reactive/BaseRedisReactiveCommands.java | 6 +- .../reactive/RedisAclReactiveCommands.java | 9 +- .../reactive/RedisGeoReactiveCommands.java | 18 +- .../reactive/RedisHLLReactiveCommands.java | 1 + .../reactive/RedisHashReactiveCommands.java | 37 ++-- .../RedisScriptingReactiveCommands.java | 7 +- .../reactive/RedisSetReactiveCommands.java | 36 ++-- .../RedisSortedSetReactiveCommands.java | 140 ++++++++----- .../reactive/RedisStreamReactiveCommands.java | 1 + .../reactive/RedisStringReactiveCommands.java | 4 +- .../RedisTransactionalReactiveCommands.java | 1 + .../core/api/sync/BaseRedisCommands.java | 5 +- .../core/api/sync/RedisAclCommands.java | 9 +- .../core/api/sync/RedisGeoCommands.java | 18 +- .../core/api/sync/RedisHLLCommands.java | 1 + .../core/api/sync/RedisHashCommands.java | 1 + .../core/api/sync/RedisScriptingCommands.java | 1 + .../core/api/sync/RedisSetCommands.java | 1 + .../core/api/sync/RedisSortedSetCommands.java | 38 ++-- .../core/api/sync/RedisStreamCommands.java | 1 + .../core/api/sync/RedisStringCommands.java | 1 + .../api/sync/RedisTransactionalCommands.java | 1 + .../core/cluster/ClusterClientOptions.java | 13 +- .../core/cluster/DynamicNodeSelection.java | 2 +- .../core/cluster/RedisClusterClient.java | 3 +- .../core/cluster/StaticNodeSelection.java | 2 +- .../async/BaseNodeSelectionAsyncCommands.java | 3 +- .../async/NodeSelectionAclAsyncCommands.java | 9 +- .../async/NodeSelectionGeoAsyncCommands.java | 27 ++- .../async/NodeSelectionHLLAsyncCommands.java | 1 + .../async/NodeSelectionHashAsyncCommands.java | 7 +- .../NodeSelectionScriptingAsyncCommands.java | 5 +- .../async/NodeSelectionSetAsyncCommands.java | 1 + .../NodeSelectionSortedSetAsyncCommands.java | 62 ++++-- .../NodeSelectionStreamAsyncCommands.java | 1 + .../NodeSelectionStringAsyncCommands.java | 1 + .../api/sync/BaseNodeSelectionCommands.java | 1 + .../api/sync/NodeSelectionAclCommands.java | 9 +- .../api/sync/NodeSelectionGeoCommands.java | 27 ++- .../api/sync/NodeSelectionHLLCommands.java | 1 + .../api/sync/NodeSelectionHashCommands.java | 1 + .../sync/NodeSelectionScriptingCommands.java | 5 +- .../api/sync/NodeSelectionSetCommands.java | 1 + .../sync/NodeSelectionSortedSetCommands.java | 44 +++-- .../api/sync/NodeSelectionStreamCommands.java | 1 + .../api/sync/NodeSelectionStringCommands.java | 1 + .../pubsub/RedisClusterPubSubListener.java | 2 +- .../StatefulRedisClusterPubSubConnection.java | 3 +- .../NodeSelectionPubSubAsyncCommands.java | 1 + .../core/cluster/topology/Connections.java | 3 +- .../DefaultClusterTopologyRefresh.java | 3 +- .../lettuce/core/dynamic/ReactiveTypes.java | 4 +- .../core/dynamic/RedisCommandFactory.java | 4 +- .../lettuce/core/dynamic/SimpleBatcher.java | 1 + .../parameter/MethodParametersAccessor.java | 8 +- .../connection/ConnectionEventSupport.java | 1 + .../event/metrics/JfrCommandLatencyEvent.java | 1 + .../masterreplica/AutodiscoveryConnector.java | 3 +- .../core/masterreplica/Connections.java | 4 +- .../core/masterreplica/SentinelConnector.java | 1 + .../StaticMasterReplicaConnector.java | 3 +- .../core/metrics/CommandLatencyCollector.java | 1 + .../CommandLatencyCollectorOptions.java | 12 +- ...DefaultCommandLatencyCollectorOptions.java | 6 +- .../core/models/command/CommandDetail.java | 4 +- .../core/models/stream/PendingMessage.java | 1 + .../core/models/stream/PendingMessages.java | 1 + .../lettuce/core/output/DoubleListOutput.java | 1 + .../lettuce/core/output/GenericMapOutput.java | 1 + .../core/output/ListOfGenericMapsOutput.java | 1 + .../lettuce/core/output/ListOfMapsOutput.java | 1 + .../lettuce/core/protocol/CommandWrapper.java | 5 +- .../core/protocol/ConnectionWatchdog.java | 1 - .../io/lettuce/core/protocol/DemandAware.java | 5 +- .../io/lettuce/core/protocol/Endpoint.java | 1 + .../core/protocol/RedisStateMachine.java | 3 +- .../core/pubsub/PubSubCommandBuilder.java | 4 +- .../core/pubsub/RedisPubSubAdapter.java | 2 +- .../core/resource/DefaultClientResources.java | 4 +- .../lettuce/core/resource/KqueueProvider.java | 4 - .../MappingSocketAddressResolver.java | 3 +- .../RedisSentinelReactiveCommandsImpl.java | 4 +- .../api/sync/RedisSentinelCommands.java | 4 +- .../support/AsyncConnectionPoolSupport.java | 1 + .../lettuce/core/support/BasePoolConfig.java | 4 +- .../core/support/ConnectionPoolSupport.java | 8 +- .../lettuce/core/api/BaseRedisCommands.java | 22 ++- .../io/lettuce/core/api/RedisAclCommands.java | 9 +- .../io/lettuce/core/api/RedisGeoCommands.java | 11 +- .../lettuce/core/api/RedisHashCommands.java | 1 + .../core/api/RedisSortedSetCommands.java | 25 ++- .../lettuce/core/api/RedisStreamCommands.java | 1 + .../redis/extensibility/LettuceGeoDemo.java | 1 + .../extensibility/MyExtendedRedisClient.java | 1 + .../extensibility/MyPubSubConnection.java | 4 +- src/test/java/io/lettuce/RedisBug.java | 2 + .../apigenerator/CompilationUnitFactory.java | 66 +++---- .../io/lettuce/apigenerator/Constants.java | 25 +-- .../lettuce/apigenerator/CreateAsyncApi.java | 5 +- .../CreateAsyncNodeSelectionClusterApi.java | 15 +- .../CreateKotlinCoroutinesApi.java | 17 +- .../apigenerator/CreateReactiveApi.java | 12 +- .../lettuce/apigenerator/CreateSyncApi.java | 5 +- .../CreateSyncNodeSelectionClusterApi.java | 15 +- .../KotlinCompilationUnitFactory.java | 185 +++++++----------- .../java/io/lettuce/codec/CRC16UnitTests.java | 3 + .../lettuce/core/AbstractRedisClientTest.java | 2 + .../core/AsyncConnectionIntegrationTests.java | 5 + .../java/io/lettuce/core/ByteBufferCodec.java | 1 + .../core/ClientMetricsIntegrationTests.java | 1 + .../core/ClientOptionsIntegrationTests.java | 1 + .../lettuce/core/ClientOptionsUnitTests.java | 1 + .../core/ConnectMethodsIntegrationTests.java | 1 + .../core/ConnectionFutureUnitTests.java | 6 +- .../core/CustomCodecIntegrationTests.java | 4 + .../core/ExceptionFactoryUnitTests.java | 13 +- .../io/lettuce/core/GeoModelUnitTests.java | 1 + .../io/lettuce/core/KeyValueUnitTests.java | 1 + .../java/io/lettuce/core/LimitUnitTests.java | 1 + .../core/PipeliningIntegrationTests.java | 2 + .../io/lettuce/core/ProtectedModeTests.java | 8 +- .../java/io/lettuce/core/RangeUnitTests.java | 1 + ...ctiveBackpressurePropagationUnitTests.java | 2 + .../ReactiveConnectionIntegrationTests.java | 5 + ...activeStreamingOutputIntegrationTests.java | 16 +- .../RedisClientConnectIntegrationTests.java | 6 +- .../core/RedisClientFactoryUnitTests.java | 12 +- .../core/RedisClientIntegrationTests.java | 11 +- .../RedisClientListenerIntegrationTests.java | 1 - .../io/lettuce/core/RedisClientUnitTests.java | 1 + .../core/RedisCommandBuilderUnitTests.java | 35 ++-- .../io/lettuce/core/ScanArgsUnitTests.java | 1 + .../io/lettuce/core/ScanCursorUnitTests.java | 1 + .../core/ScanIteratorIntegrationTests.java | 24 +-- .../core/ScanStreamIntegrationTests.java | 2 + .../core/ScoredValueStreamingAdapter.java | 2 + .../io/lettuce/core/ScoredValueUnitTests.java | 1 + .../core/SocketOptionsIntegrationTests.java | 1 + .../lettuce/core/SocketOptionsUnitTests.java | 6 +- .../io/lettuce/core/SslIntegrationTests.java | 8 +- .../io/lettuce/core/SslOptionsUnitTests.java | 1 + .../SyncAsyncApiConvergenceUnitTests.java | 5 +- .../io/lettuce/core/TestRedisPublisher.java | 1 + .../java/io/lettuce/core/TestSupport.java | 4 + .../lettuce/core/TimeoutOptionsUnitTests.java | 1 + .../UnixDomainSocketIntegrationTests.java | 5 +- .../core/Utf8StringCodecIntegrationTests.java | 1 + .../java/io/lettuce/core/ValueUnitTests.java | 5 +- .../lettuce/core/ZAggregateArgsUnitTests.java | 1 + ...AdvancedClusterClientIntegrationTests.java | 20 +- ...vancedClusterReactiveIntegrationTests.java | 4 + ...yncConnectionProviderIntegrationTests.java | 18 +- .../ByteCodecClusterIntegrationTests.java | 1 + .../ClusterClientOptionsIntegrationTests.java | 9 +- .../ClusterClientOptionsUnitTests.java | 5 +- .../ClusterCommandIntegrationTests.java | 17 +- .../core/cluster/ClusterCommandUnitTests.java | 2 + ...terDistributionChannelWriterUnitTests.java | 25 ++- .../cluster/ClusterNodeEndpointUnitTests.java | 1 + .../ClusterPartiallyDownIntegrationTests.java | 7 + ...lusterReactiveCommandIntegrationTests.java | 3 + .../io/lettuce/core/cluster/ClusterSetup.java | 6 +- .../core/cluster/ClusterTestHelper.java | 9 +- .../core/cluster/ClusterTestSettings.java | 8 + .../lettuce/core/cluster/ClusterTestUtil.java | 4 +- ...sterTopologyRefreshSchedulerUnitTests.java | 1 + .../cluster/CommandSetIntegrationTests.java | 2 + ...yMajorityPartitionsConsensusUnitTests.java | 5 + ...nMajorityPartitionsConsensusUnitTests.java | 5 + .../NodeSelectionAsyncIntegrationTests.java | 46 ++--- .../PartitionsConsensusTestSupport.java | 3 +- .../PipelinedRedisFutureUnitTests.java | 1 + ...ledClusterConnectionProviderUnitTests.java | 23 ++- .../core/cluster/ReadFromUnitTests.java | 5 + .../RedisClusterClientFactoryTests.java | 31 +-- ...terPasswordSecuredSslIntegrationTests.java | 4 + .../RedisClusterReadFromIntegrationTests.java | 2 + .../core/cluster/RedisClusterSetupTest.java | 29 ++- .../RedisClusterStressScenariosTest.java | 5 + .../cluster/RedisClusterURIUtilUnitTests.java | 1 + ...ReactiveClusterClientIntegrationTests.java | 10 +- ...ndRobinSocketAddressSupplierUnitTests.java | 10 +- .../cluster/ScanIteratorIntegrationTests.java | 8 +- .../cluster/ScanStreamIntegrationTests.java | 2 + ...ReactiveClusterClientIntegrationTests.java | 1 + .../core/cluster/SlotHashUnitTests.java | 2 + .../ListClusterCommandIntegrationTests.java | 3 +- ...lusterReactiveCommandIntegrationTests.java | 1 + ...lusterReactiveCommandIntegrationTests.java | 2 + .../partitions/RedisClusterNodeUnitTests.java | 1 + .../slots/ClusterSlotsParserUnitTests.java | 1 + .../cluster/topology/RequestsUnitTests.java | 1 + .../TopologyComparatorsUnitTests.java | 3 + .../core/codec/CipherCodecUnitTests.java | 11 +- .../core/codec/CompressionCodecUnitTests.java | 7 +- .../core/codec/StringCodecUnitTests.java | 10 +- .../commands/BitCommandIntegrationTests.java | 1 + .../lettuce/core/commands/BitStringCodec.java | 1 + .../CustomCommandIntegrationTests.java | 16 +- .../commands/HLLCommandIntegrationTests.java | 1 + .../commands/HashCommandIntegrationTests.java | 30 +-- .../NumericCommandIntegrationTests.java | 1 + ...OnlyOnceServerCommandIntegrationTests.java | 7 +- .../ServerCommandIntegrationTests.java | 6 +- .../commands/SetCommandIntegrationTests.java | 4 +- .../StringCommandIntegrationTests.java | 21 +- .../TransactionCommandIntegrationTests.java | 10 +- .../BitReactiveCommandIntegrationTests.java | 5 +- ...CustomReactiveCommandIntegrationTests.java | 9 +- .../GeoReactiveCommandIntegrationTests.java | 1 + .../HLLReactiveCommandIntegrationTests.java | 1 + .../HashReactiveCommandIntegrationTests.java | 1 + .../KeyReactiveCommandIntegrationTests.java | 1 + .../ListReactiveCommandIntegrationTests.java | 1 + ...umericReactiveCommandIntegrationTests.java | 1 + ...iptingReactiveCommandIntegrationTests.java | 1 + .../SetReactiveCommandIntegrationTests.java | 1 + .../SortReactiveCommandIntegrationTests.java | 1 + ...tedSetReactiveCommandIntegrationTests.java | 1 + ...StreamReactiveCommandIntegrationTests.java | 1 + ...StringReactiveCommandIntegrationTests.java | 2 + .../BitTxCommandIntegrationTests.java | 1 + .../GeoTxCommandIntegrationTests.java | 1 + .../HLLTxCommandIntegrationTests.java | 1 + .../HashTxCommandIntegrationTests.java | 1 + .../KeyTxCommandIntegrationTests.java | 1 + .../ListTxCommandIntegrationTests.java | 1 + .../SetTxCommandIntegrationTests.java | 1 + .../SortTxCommandIntegrationTests.java | 1 + .../SortedSetTxCommandIntegrationTests.java | 1 + .../StringTxCommandIntegrationTests.java | 1 + .../TxSyncInvocationHandler.java | 5 + ...cutableCommandLookupStrategyUnitTests.java | 7 +- ...CommandSegmentCommandFactoryUnitTests.java | 3 + .../dynamic/ConversionServiceUnitTests.java | 4 + .../DeclaredCommandMethodUnitTests.java | 2 + ...DefaultCommandMethodVerifierUnitTests.java | 2 + .../dynamic/ParameterBinderUnitTests.java | 23 +-- ...CommandSegmentCommandFactoryUnitTests.java | 2 + .../ReactiveTypeAdaptersUnitTests.java | 1 + .../ReactiveTypeAdaptionIntegrationTests.java | 6 + .../RedisCommandsAsyncIntegrationTests.java | 3 + ...RedisCommandsBatchingIntegrationTests.java | 1 + .../RedisCommandsClusterIntegrationTests.java | 1 + .../RedisCommandsIntegrationTests.java | 12 +- ...RedisCommandsReactiveIntegrationTests.java | 2 + .../RedisCommandsSyncIntegrationTests.java | 2 + .../core/dynamic/SimpleBatcherUnitTests.java | 1 + ...AnnotationRedisCodecResolverUnitTests.java | 1 + .../codec/ParameterWrappersUnitTests.java | 1 + .../InvocationProxyFactoryUnitTests.java | 5 + .../CodecAwareOutputResolverUnitTests.java | 3 + ...CommandOutputFactoryResolverUnitTests.java | 8 +- .../output/OutputRegistryUnitTests.java | 3 + ...otationCommandSegmentFactoryUnitTests.java | 23 ++- .../ParametrizedTypeInformationUnitTests.java | 2 + .../WildcardTypeInformationUnitTests.java | 2 + ...ectionEventsTriggeredIntegrationTests.java | 1 + .../core/event/DefaultEventBusUnitTests.java | 1 + ...DefaultEventPublisherOptionsUnitTests.java | 1 + .../AbstractInvocationHandlerUnitTests.java | 3 + .../core/internal/FuturesUnitTests.java | 1 + .../core/internal/HostAndPortUnitTests.java | 1 + .../internal/TimeoutProviderUnitTests.java | 1 + .../masterreplica/ConnectionsUnitTests.java | 1 + .../CustomCommandIntegrationTests.java | 4 + .../MasterReplicaChannelWriterUnitTests.java | 22 +-- ...terReplicaSentinelSslIntegrationTests.java | 1 + .../core/masterreplica/MasterReplicaTest.java | 5 + ...asterReplicaTopologyProviderUnitTests.java | 5 +- ...MasterReplicaTopologyRefreshUnitTests.java | 7 +- .../MasterReplicaUtilsUnitTests.java | 1 + .../SentinelTopologyRefreshUnitTests.java | 16 +- .../StaticMasterReplicaTest.java | 3 + .../MasterSlaveSentinelIntegrationTests.java | 2 + .../core/masterslave/MasterSlaveTest.java | 4 + .../masterslave/StaticMasterSlaveTest.java | 2 + ...mmandLatencyCollectorOptionsUnitTests.java | 5 +- .../metrics/CommandLatencyIdUnitTests.java | 2 + ...mmandLatencyCollectorOptionsUnitTests.java | 5 +- ...faultCommandLatencyCollectorUnitTests.java | 13 +- ...ometerCommandLatencyRecorderUnitTests.java | 9 +- .../core/models/role/RoleParserUnitTests.java | 10 +- .../models/stream/PendingParserUnitTests.java | 8 +- .../output/BooleanListOutputUnitTests.java | 1 + .../GeoCoordinatesListOutputUnitTests.java | 1 + ...eoCoordinatesValueListOutputUnitTests.java | 1 + .../output/GeoWithinListOutputUnitTests.java | 1 + .../core/output/ListOutputUnitTests.java | 5 + .../core/output/MultiOutputUnitTests.java | 1 + .../core/output/ObjectOutputTests.java | 128 +++--------- .../core/output/ReplayOutputUnitTests.java | 1 + .../ScoredValueListOutputUnitTests.java | 1 + .../output/SocketAddressOutputUnitTests.java | 1 + .../output/StreamReadOutputUnitTests.java | 1 + .../core/protocol/AsyncCommandUnitTests.java | 12 +- .../core/protocol/CommandArgsUnitTests.java | 1 + .../core/protocol/CommandUnitTests.java | 7 + .../protocol/CommandWrapperUnitTests.java | 2 + .../ConnectionFailureIntegrationTests.java | 12 +- .../protocol/DefaultEndpointUnitTests.java | 6 +- .../protocol/RatioDecodeBufferPolicyTest.java | 1 + .../RedisStateMachineResp2UnitTests.java | 4 + .../RedisStateMachineResp3UnitTests.java | 12 +- .../core/protocol/StateMachineUnitTests.java | 4 + .../TransactionalCommandUnitTests.java | 1 + .../pubsub/PubSubCommandHandlerUnitTests.java | 1 + .../core/pubsub/PubSubEndpointUnitTests.java | 5 + .../core/pubsub/PubSubReactiveTest.java | 1 + ...RedisPubSubAsyncCommandsImplUnitTests.java | 52 +++-- ...fulRedisPubSubConnectionImplUnitTests.java | 10 +- .../reactive/RedisPublisherVerification.java | 1 + .../core/reactive/ScanStreamVerification.java | 3 +- .../core/reliability/AtLeastOnceTest.java | 10 +- .../core/reliability/AtMostOnceTest.java | 3 + .../core/resource/ConstantDelayUnitTests.java | 1 + .../DecorrelatedJitterDelayUnitTests.java | 9 +- ...efaultEventLoopGroupProviderUnitTests.java | 1 + .../resource/DirContextDnsResolverTests.java | 1 + .../resource/EqualJitterDelayUnitTests.java | 9 +- .../resource/ExponentialDelayUnitTests.java | 13 +- .../resource/FullJitterDelayUnitTests.java | 9 +- ...MappingSocketAddressResolverUnitTests.java | 1 + .../SentinelCommandIntegrationTests.java | 6 +- .../SentinelConnectionIntegrationTests.java | 10 +- ...SentinelServerCommandIntegrationTests.java | 2 + .../sentinel/SentinelSslIntegrationTests.java | 1 + .../core/sentinel/SentinelTestSettings.java | 2 + .../reactive/SentinelReactiveCommandTest.java | 4 +- .../SentinelServerReactiveCommandTest.java | 1 + ...ConnectionPoolSupportIntegrationTests.java | 35 ++-- .../AsyncPoolWithValidationUnitTests.java | 9 +- .../core/support/CdiIntegrationTests.java | 1 + .../CommonsPool2ConfigConverterUnitTests.java | 1 + ...ConnectionPoolSupportIntegrationTests.java | 74 +++---- .../lettuce/core/support/InjectedClient.java | 1 + .../ClientsideCachingIntegrationTests.java | 2 + .../core/tracing/BraveTracingUnitTests.java | 6 +- .../examples/ConnectToElastiCacheMaster.java | 1 + ...tToMasterSlaveUsingElastiCacheCluster.java | 1 + ...onnectToMasterSlaveUsingRedisSentinel.java | 1 + .../io/lettuce/examples/ConnectToRedis.java | 1 + .../examples/ConnectToRedisCluster.java | 1 + .../examples/ConnectToRedisClusterSSL.java | 1 + ...tToRedisClusterWithTopologyRefreshing.java | 1 + .../lettuce/examples/ConnectToRedisSSL.java | 1 + .../ConnectToRedisUsingRedisSentinel.java | 1 + .../io/lettuce/examples/ReadWriteExample.java | 1 + src/test/java/io/lettuce/test/CanConnect.java | 1 + src/test/java/io/lettuce/test/CliParser.java | 3 + ...ConnectionDecoratingInvocationHandler.java | 1 + .../io/lettuce/test/ConnectionTestUtil.java | 1 + src/test/java/io/lettuce/test/Delay.java | 1 + .../test/KeyValueStreamingAdapter.java | 1 + .../java/io/lettuce/test/KeysAndValues.java | 1 + .../io/lettuce/test/LettuceExtension.java | 24 ++- .../io/lettuce/test/ListStreamingAdapter.java | 6 +- .../test/ReactiveSyncInvocationHandler.java | 4 +- .../test/RoutingInvocationHandler.java | 1 + src/test/java/io/lettuce/test/Wait.java | 19 ++ .../java/io/lettuce/test/WithPassword.java | 3 + .../test/condition/EnabledOnCommand.java | 1 + .../condition/EnabledOnCommandCondition.java | 6 +- .../test/condition/RedisConditions.java | 14 +- .../test/resource/DefaultRedisClient.java | 3 + .../resource/DefaultRedisClusterClient.java | 7 +- .../lettuce/test/resource/FastShutdown.java | 1 + .../test/resource/TestClientResources.java | 7 +- .../resource/TestEventLoopGroupProvider.java | 3 + .../io/lettuce/test/server/MockTcpServer.java | 7 + .../test/server/RandomResponseServer.java | 1 + .../test/server/RandomServerHandler.java | 1 + 409 files changed, 1869 insertions(+), 1199 deletions(-) diff --git a/pom.xml b/pom.xml index 0dbefd614c..20c34575a3 100644 --- a/pom.xml +++ b/pom.xml @@ -841,6 +841,27 @@ + + net.revelc.code.formatter + formatter-maven-plugin + 2.16.0 + + + ${project.build.sourceDirectory} + ${project.build.testSourceDirectory} + ${project.basedir}/src/main/templates + + formatting.xml + + + + + validate + + + + + org.apache.maven.plugins maven-failsafe-plugin diff --git a/src/main/java/io/lettuce/core/AbstractRedisClient.java b/src/main/java/io/lettuce/core/AbstractRedisClient.java index 64ff3d90a5..9adff50624 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisClient.java +++ b/src/main/java/io/lettuce/core/AbstractRedisClient.java @@ -305,9 +305,8 @@ protected void channelType(ConnectionBuilder connectionBuilder, ConnectionPoint LettuceAssert.notNull(connectionPoint, "ConnectionPoint must not be null"); boolean domainSocket = LettuceStrings.isNotEmpty(connectionPoint.getSocket()); - connectionBuilder.bootstrap().group( - getEventLoopGroup( - domainSocket ? NativeTransports.eventLoopGroupClass(true) : Transports.eventLoopGroupClass())); + connectionBuilder.bootstrap().group(getEventLoopGroup( + domainSocket ? NativeTransports.eventLoopGroupClass(true) : Transports.eventLoopGroupClass())); if (connectionPoint.getSocket() != null) { NativeTransports.assertDomainSocketAvailable(); diff --git a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java index c0bfab6ab5..16ae6c5796 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java @@ -1357,7 +1357,7 @@ public Mono hscan(KeyValueStreamingChannel channel, K ke @Override public Mono hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, - ScanArgs scanArgs) { + ScanArgs scanArgs) { return createMono(() -> commandBuilder.hscanNoValuesStreaming(channel, key, scanCursor, scanArgs)); } @@ -2151,7 +2151,7 @@ public Flux spop(K key, long count) { public Mono spublish(K shardChannel, V message) { return createMono(() -> commandBuilder.spublish(shardChannel, message)); } - + @Override public Mono srandmember(K key) { return createMono(() -> commandBuilder.srandmember(key)); diff --git a/src/main/java/io/lettuce/core/ChannelGroupListener.java b/src/main/java/io/lettuce/core/ChannelGroupListener.java index b704f60d89..967e58f935 100644 --- a/src/main/java/io/lettuce/core/ChannelGroupListener.java +++ b/src/main/java/io/lettuce/core/ChannelGroupListener.java @@ -67,4 +67,5 @@ private static String getRedisUri(Channel channel) { private static CommandHandler getCommandHandler(ChannelHandlerContext ctx) { return ctx.pipeline().get(CommandHandler.class); } + } diff --git a/src/main/java/io/lettuce/core/ClientOptions.java b/src/main/java/io/lettuce/core/ClientOptions.java index a8f3eee83b..aa3d2ba188 100644 --- a/src/main/java/io/lettuce/core/ClientOptions.java +++ b/src/main/java/io/lettuce/core/ClientOptions.java @@ -97,7 +97,6 @@ public class ClientOptions implements Serializable { private final TimeoutOptions timeoutOptions; - protected ClientOptions(Builder builder) { this.autoReconnect = builder.autoReconnect; this.cancelCommandsOnReconnectFailure = builder.cancelCommandsOnReconnectFailure; @@ -448,11 +447,11 @@ public ClientOptions.Builder mutate() { builder.autoReconnect(isAutoReconnect()).cancelCommandsOnReconnectFailure(isCancelCommandsOnReconnectFailure()) .decodeBufferPolicy(getDecodeBufferPolicy()).disconnectedBehavior(getDisconnectedBehavior()) - .readOnlyCommands(getReadOnlyCommands()) - .publishOnScheduler(isPublishOnScheduler()).pingBeforeActivateConnection(isPingBeforeActivateConnection()) - .protocolVersion(getConfiguredProtocolVersion()).requestQueueSize(getRequestQueueSize()) - .scriptCharset(getScriptCharset()).socketOptions(getSocketOptions()).sslOptions(getSslOptions()) - .suspendReconnectOnProtocolFailure(isSuspendReconnectOnProtocolFailure()).timeoutOptions(getTimeoutOptions()); + .readOnlyCommands(getReadOnlyCommands()).publishOnScheduler(isPublishOnScheduler()) + .pingBeforeActivateConnection(isPingBeforeActivateConnection()).protocolVersion(getConfiguredProtocolVersion()) + .requestQueueSize(getRequestQueueSize()).scriptCharset(getScriptCharset()).socketOptions(getSocketOptions()) + .sslOptions(getSslOptions()).suspendReconnectOnProtocolFailure(isSuspendReconnectOnProtocolFailure()) + .timeoutOptions(getTimeoutOptions()); return builder; } diff --git a/src/main/java/io/lettuce/core/CopyArgs.java b/src/main/java/io/lettuce/core/CopyArgs.java index 2b38787333..33b73c6ea0 100644 --- a/src/main/java/io/lettuce/core/CopyArgs.java +++ b/src/main/java/io/lettuce/core/CopyArgs.java @@ -33,75 +33,75 @@ */ public class CopyArgs implements CompositeArgument { - private Long destinationDb; + private Long destinationDb; private boolean replace; - /** - * Builder entry points for {@link CopyArgs}. - */ - public static class Builder { - - /** - * Utility constructor. - */ - private Builder() { - } - - /** - * Creates new {@link CopyArgs} and sets {@literal DB}. - * - * @return new {@link CopyArgs} with {@literal DB} set. - */ - public static CopyArgs destinationDb(long destinationDb) { - return new CopyArgs().destinationDb(destinationDb); - } - - /** - * Creates new {@link CopyArgs} and sets {@literal REPLACE}. - * - * @return new {@link CopyArgs} with {@literal REPLACE} set. - */ - public static CopyArgs replace(boolean replace) { - return new CopyArgs().replace(replace); - } - - } - - /** - * Specify an alternative logical database index for the destination key. - * - * @param destinationDb logical database index to apply for {@literal DB}. - * @return {@code this}. - */ - public CopyArgs destinationDb(long destinationDb) { - - this.destinationDb = destinationDb; - return this; - } - - /** - * Hint redis to remove the destination key before copying the value to it. - * - * @param replace remove destination key before copying the value {@literal REPLACE}. - * @return {@code this}. - */ - public CopyArgs replace(boolean replace) { - - this.replace = replace; - return this; - } + /** + * Builder entry points for {@link CopyArgs}. + */ + public static class Builder { + + /** + * Utility constructor. + */ + private Builder() { + } + + /** + * Creates new {@link CopyArgs} and sets {@literal DB}. + * + * @return new {@link CopyArgs} with {@literal DB} set. + */ + public static CopyArgs destinationDb(long destinationDb) { + return new CopyArgs().destinationDb(destinationDb); + } + + /** + * Creates new {@link CopyArgs} and sets {@literal REPLACE}. + * + * @return new {@link CopyArgs} with {@literal REPLACE} set. + */ + public static CopyArgs replace(boolean replace) { + return new CopyArgs().replace(replace); + } + + } + + /** + * Specify an alternative logical database index for the destination key. + * + * @param destinationDb logical database index to apply for {@literal DB}. + * @return {@code this}. + */ + public CopyArgs destinationDb(long destinationDb) { + + this.destinationDb = destinationDb; + return this; + } + + /** + * Hint redis to remove the destination key before copying the value to it. + * + * @param replace remove destination key before copying the value {@literal REPLACE}. + * @return {@code this}. + */ + public CopyArgs replace(boolean replace) { + + this.replace = replace; + return this; + } @Override - public void build(CommandArgs args) { + public void build(CommandArgs args) { - if (destinationDb != null) { - args.add(CommandKeyword.DB).add(destinationDb); - } + if (destinationDb != null) { + args.add(CommandKeyword.DB).add(destinationDb); + } if (replace) { - args.add(CommandKeyword.REPLACE); - } - } + args.add(CommandKeyword.REPLACE); + } + } } diff --git a/src/main/java/io/lettuce/core/FlushMode.java b/src/main/java/io/lettuce/core/FlushMode.java index 9e2f4e5466..98b64dcdb3 100644 --- a/src/main/java/io/lettuce/core/FlushMode.java +++ b/src/main/java/io/lettuce/core/FlushMode.java @@ -51,4 +51,5 @@ public enum FlushMode implements ProtocolKeyword { public byte[] getBytes() { return bytes; } + } diff --git a/src/main/java/io/lettuce/core/GeoArgs.java b/src/main/java/io/lettuce/core/GeoArgs.java index 26ed8120e8..968cdab68e 100644 --- a/src/main/java/io/lettuce/core/GeoArgs.java +++ b/src/main/java/io/lettuce/core/GeoArgs.java @@ -266,6 +266,7 @@ public enum Unit implements ProtocolKeyword { public byte[] getBytes() { return asBytes; } + } public void build(CommandArgs args) { diff --git a/src/main/java/io/lettuce/core/KillArgs.java b/src/main/java/io/lettuce/core/KillArgs.java index d3a05c3b83..2a71b051d7 100644 --- a/src/main/java/io/lettuce/core/KillArgs.java +++ b/src/main/java/io/lettuce/core/KillArgs.java @@ -27,8 +27,8 @@ /** * - * Argument list builder for the Redis CLIENT KILL command. Static import the - * methods from {@link Builder} and chain the method calls: {@code id(1).skipme()}. + * Argument list builder for the Redis CLIENT KILL command. Static import + * the methods from {@link Builder} and chain the method calls: {@code id(1).skipme()}. *

* {@link KillArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * @@ -159,6 +159,7 @@ public static KillArgs typeSlave() { public static KillArgs user(String username) { return new KillArgs().user(username); } + } /** diff --git a/src/main/java/io/lettuce/core/LMoveArgs.java b/src/main/java/io/lettuce/core/LMoveArgs.java index 35b270db5b..e248063491 100644 --- a/src/main/java/io/lettuce/core/LMoveArgs.java +++ b/src/main/java/io/lettuce/core/LMoveArgs.java @@ -89,10 +89,12 @@ public static LMoveArgs rightLeft() { public static LMoveArgs rightRight() { return new LMoveArgs(CommandKeyword.RIGHT, CommandKeyword.RIGHT); } + } @Override public void build(CommandArgs args) { args.add(source).add(destination); } + } diff --git a/src/main/java/io/lettuce/core/MigrateArgs.java b/src/main/java/io/lettuce/core/MigrateArgs.java index 77af12e6da..22e2d07e80 100644 --- a/src/main/java/io/lettuce/core/MigrateArgs.java +++ b/src/main/java/io/lettuce/core/MigrateArgs.java @@ -29,8 +29,8 @@ import io.lettuce.core.protocol.CommandType; /** - * Argument list builder for the Redis MIGRATE command. Static import the methods - * from {@link Builder} and chain the method calls: {@code copy().auth("foobar")}. + * Argument list builder for the Redis MIGRATE command. Static import the + * methods from {@link Builder} and chain the method calls: {@code copy().auth("foobar")}. *

* {@link MigrateArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * diff --git a/src/main/java/io/lettuce/core/Range.java b/src/main/java/io/lettuce/core/Range.java index 12c631efe4..28932159cb 100644 --- a/src/main/java/io/lettuce/core/Range.java +++ b/src/main/java/io/lettuce/core/Range.java @@ -261,7 +261,6 @@ public int hashCode() { return Objects.hash(value, including); } - @Override public String toString() { diff --git a/src/main/java/io/lettuce/core/ReadFromImpl.java b/src/main/java/io/lettuce/core/ReadFromImpl.java index 303fb26054..32295b970f 100644 --- a/src/main/java/io/lettuce/core/ReadFromImpl.java +++ b/src/main/java/io/lettuce/core/ReadFromImpl.java @@ -62,6 +62,7 @@ public List select(Nodes nodes) { return Collections.emptyList(); } + } /** diff --git a/src/main/java/io/lettuce/core/RedisChannelWriter.java b/src/main/java/io/lettuce/core/RedisChannelWriter.java index bea2f44683..fbaf1bf0cb 100644 --- a/src/main/java/io/lettuce/core/RedisChannelWriter.java +++ b/src/main/java/io/lettuce/core/RedisChannelWriter.java @@ -69,8 +69,8 @@ public interface RedisChannelWriter extends Closeable, AsyncCloseable { void setConnectionFacade(ConnectionFacade connection); /** - * Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands - * can be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is + * Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands can + * be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is * issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis. * * @param autoFlush state of autoFlush. diff --git a/src/main/java/io/lettuce/core/RedisClient.java b/src/main/java/io/lettuce/core/RedisClient.java index c87497c625..550c5bf104 100644 --- a/src/main/java/io/lettuce/core/RedisClient.java +++ b/src/main/java/io/lettuce/core/RedisClient.java @@ -744,28 +744,28 @@ private Mono lookupRedis(RedisURI sentinelUri) { return Mono.usingWhen( Mono.fromCompletionStage(() -> connectSentinelAsync(newStringStringCodec(), sentinelUri, timeout)), c -> { - String sentinelMasterId = sentinelUri.getSentinelMasterId(); - return c.reactive().getMasterAddrByName(sentinelMasterId).map(it -> { + String sentinelMasterId = sentinelUri.getSentinelMasterId(); + return c.reactive().getMasterAddrByName(sentinelMasterId).map(it -> { - if (it instanceof InetSocketAddress) { + if (it instanceof InetSocketAddress) { - InetSocketAddress isa = (InetSocketAddress) it; - SocketAddress resolved = getResources().socketAddressResolver() - .resolve(RedisURI.create(isa.getHostString(), isa.getPort())); + InetSocketAddress isa = (InetSocketAddress) it; + SocketAddress resolved = getResources().socketAddressResolver() + .resolve(RedisURI.create(isa.getHostString(), isa.getPort())); - logger.debug("Resolved Master {} SocketAddress {}:{} to {}", sentinelMasterId, isa.getHostString(), - isa.getPort(), resolved); + logger.debug("Resolved Master {} SocketAddress {}:{} to {}", sentinelMasterId, isa.getHostString(), + isa.getPort(), resolved); - return resolved; - } + return resolved; + } - return it; - }).timeout(timeout) // + return it; + }).timeout(timeout) // .onErrorMap(e -> { - RedisCommandTimeoutException ex = ExceptionFactory - .createTimeoutException("Cannot obtain master using SENTINEL MASTER", timeout); - ex.addSuppressed(e); + RedisCommandTimeoutException ex = ExceptionFactory + .createTimeoutException("Cannot obtain master using SENTINEL MASTER", timeout); + ex.addSuppressed(e); return ex; }); diff --git a/src/main/java/io/lettuce/core/RedisCommandBuilder.java b/src/main/java/io/lettuce/core/RedisCommandBuilder.java index 9c69d01912..8d74e0deb9 100644 --- a/src/main/java/io/lettuce/core/RedisCommandBuilder.java +++ b/src/main/java/io/lettuce/core/RedisCommandBuilder.java @@ -1689,7 +1689,7 @@ Command hscanStreaming(KeyValueStreamingChannel ch } Command hscanNoValuesStreaming(KeyStreamingChannel channel, K key, ScanCursor scanCursor, - ScanArgs scanArgs) { + ScanArgs scanArgs) { notNullKey(key); notNull(channel); diff --git a/src/main/java/io/lettuce/core/RedisHandshake.java b/src/main/java/io/lettuce/core/RedisHandshake.java index a7ccc7a9a6..21fe829bb4 100644 --- a/src/main/java/io/lettuce/core/RedisHandshake.java +++ b/src/main/java/io/lettuce/core/RedisHandshake.java @@ -283,13 +283,11 @@ private CompletableFuture applyConnectionMetadata(Channel channel) { } if (LettuceStrings.isNotEmpty(metadata.getLibraryName())) { - postHandshake.add( - new AsyncCommand<>(this.commandBuilder.clientSetinfo("lib-name", metadata.getLibraryName()))); + postHandshake.add(new AsyncCommand<>(this.commandBuilder.clientSetinfo("lib-name", metadata.getLibraryName()))); } if (LettuceStrings.isNotEmpty(metadata.getLibraryVersion())) { - postHandshake.add( - new AsyncCommand<>(this.commandBuilder.clientSetinfo("lib-ver", metadata.getLibraryVersion()))); + postHandshake.add(new AsyncCommand<>(this.commandBuilder.clientSetinfo("lib-ver", metadata.getLibraryVersion()))); } if (postHandshake.isEmpty()) { diff --git a/src/main/java/io/lettuce/core/RedisPublisher.java b/src/main/java/io/lettuce/core/RedisPublisher.java index f19de1fed1..10f87be281 100644 --- a/src/main/java/io/lettuce/core/RedisPublisher.java +++ b/src/main/java/io/lettuce/core/RedisPublisher.java @@ -414,7 +414,8 @@ void potentiallyReadMore() { /* * getDemand() maybe is Long.MAX_VALUE,because MonoNext.NextSubscriber#request(long n) inner use the Long.MAX_VALUE, - * so maybe "getDemand() + 1" will be overflow,we use "getDemand() > data.size() - 1" replace the "(getDemand() + 1) > data.size()" + * so maybe "getDemand() + 1" will be overflow,we use "getDemand() > data.size() - 1" replace the + * "(getDemand() + 1) > data.size()" */ if (getDemand() > data.size() - 1) { state().readData(this); diff --git a/src/main/java/io/lettuce/core/RestoreArgs.java b/src/main/java/io/lettuce/core/RestoreArgs.java index ff18ebfe5c..3fac6b9361 100644 --- a/src/main/java/io/lettuce/core/RestoreArgs.java +++ b/src/main/java/io/lettuce/core/RestoreArgs.java @@ -27,8 +27,8 @@ import io.lettuce.core.protocol.CommandArgs; /** - * Argument list builder for the Redis RESTORE command. Static import the methods - * from {@link RestoreArgs.Builder} and call the methods: {@code ttl(…)} . + * Argument list builder for the Redis RESTORE command. Static import the + * methods from {@link RestoreArgs.Builder} and call the methods: {@code ttl(…)} . *

* {@link RestoreArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * @@ -199,4 +199,5 @@ public void build(CommandArgs args) { args.add(FREQ).add(frequency); } } + } diff --git a/src/main/java/io/lettuce/core/ScanIterator.java b/src/main/java/io/lettuce/core/ScanIterator.java index 11cec3513e..011eb02dc7 100644 --- a/src/main/java/io/lettuce/core/ScanIterator.java +++ b/src/main/java/io/lettuce/core/ScanIterator.java @@ -185,8 +185,7 @@ private MapScanCursor getNextScanCursor(ScanCursor scanCursor) { }; } - private static ScanIterator hscanNovalues(RedisHashCommands commands, K key, - Optional scanArgs) { + private static ScanIterator hscanNovalues(RedisHashCommands commands, K key, Optional scanArgs) { LettuceAssert.notNull(commands, "RedisKeyCommands must not be null"); LettuceAssert.notNull(key, "Key must not be null"); @@ -204,7 +203,8 @@ protected ScanCursor nextScanCursor(ScanCursor scanCursor) { private KeyScanCursor getNextScanCursor(ScanCursor scanCursor) { if (scanCursor == null) { - return scanArgs.map(scanArgs -> commands.hscanNovalues(key, scanArgs)).orElseGet(() -> commands.hscanNovalues(key)); + return scanArgs.map(scanArgs -> commands.hscanNovalues(key, scanArgs)) + .orElseGet(() -> commands.hscanNovalues(key)); } return scanArgs.map((scanArgs) -> commands.hscanNovalues(key, scanCursor, scanArgs)) diff --git a/src/main/java/io/lettuce/core/ScanStream.java b/src/main/java/io/lettuce/core/ScanStream.java index f9fe147abc..560c22a4a0 100644 --- a/src/main/java/io/lettuce/core/ScanStream.java +++ b/src/main/java/io/lettuce/core/ScanStream.java @@ -177,8 +177,7 @@ private static Flux> hscan(RedisHashReactiveCommands }); } - private static Flux hscanNovalues(RedisHashReactiveCommands commands, K key, - Optional scanArgs) { + private static Flux hscanNovalues(RedisHashReactiveCommands commands, K key, Optional scanArgs) { LettuceAssert.notNull(commands, "RedisHashReactiveCommands must not be null"); LettuceAssert.notNull(key, "Key must not be null"); diff --git a/src/main/java/io/lettuce/core/SetArgs.java b/src/main/java/io/lettuce/core/SetArgs.java index a4a5387829..3f6102f08d 100644 --- a/src/main/java/io/lettuce/core/SetArgs.java +++ b/src/main/java/io/lettuce/core/SetArgs.java @@ -29,8 +29,8 @@ import io.lettuce.core.protocol.CommandArgs; /** - * Argument list builder for the Redis SET command starting from Redis 2.6.12. Static - * import the methods from {@link Builder} and chain the method calls: {@code ex(10).nx()}. + * Argument list builder for the Redis SET command starting from Redis 2.6.12. + * Static import the methods from {@link Builder} and chain the method calls: {@code ex(10).nx()}. *

* {@link SetArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * diff --git a/src/main/java/io/lettuce/core/ShutdownArgs.java b/src/main/java/io/lettuce/core/ShutdownArgs.java index 47b134edaf..295f2bd69f 100644 --- a/src/main/java/io/lettuce/core/ShutdownArgs.java +++ b/src/main/java/io/lettuce/core/ShutdownArgs.java @@ -91,6 +91,7 @@ public static ShutdownArgs force() { public static ShutdownArgs abort() { return new ShutdownArgs().abort(); } + } /** diff --git a/src/main/java/io/lettuce/core/StrAlgoArgs.java b/src/main/java/io/lettuce/core/StrAlgoArgs.java index 009f916fd4..2df6daccac 100644 --- a/src/main/java/io/lettuce/core/StrAlgoArgs.java +++ b/src/main/java/io/lettuce/core/StrAlgoArgs.java @@ -26,8 +26,8 @@ import io.lettuce.core.protocol.CommandArgs; /** - * Argument list builder for the Redis STRALGO command. Static import the methods - * from {@link StrAlgoArgs.Builder} and call the methods: {@code keys(…)} . + * Argument list builder for the Redis STRALGO command. Static import the + * methods from {@link StrAlgoArgs.Builder} and call the methods: {@code keys(…)} . *

* {@link StrAlgoArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * diff --git a/src/main/java/io/lettuce/core/XAutoClaimArgs.java b/src/main/java/io/lettuce/core/XAutoClaimArgs.java index ad2e45ebee..04408b71e2 100644 --- a/src/main/java/io/lettuce/core/XAutoClaimArgs.java +++ b/src/main/java/io/lettuce/core/XAutoClaimArgs.java @@ -212,4 +212,5 @@ public void build(CommandArgs args) { args.add(CommandKeyword.JUSTID); } } + } diff --git a/src/main/java/io/lettuce/core/XTrimArgs.java b/src/main/java/io/lettuce/core/XTrimArgs.java index 153a8619d4..0e302ad221 100644 --- a/src/main/java/io/lettuce/core/XTrimArgs.java +++ b/src/main/java/io/lettuce/core/XTrimArgs.java @@ -24,8 +24,8 @@ import io.lettuce.core.protocol.CommandKeyword; /** - * Argument list builder for the Redis XTRIM command. Static import the methods from - * {@link Builder} and call the methods: {@code maxlen(…)} . + * Argument list builder for the Redis XTRIM command. Static import the methods + * from {@link Builder} and call the methods: {@code maxlen(…)} . *

* {@link XTrimArgs} is a mutable object and instances should be used only once to avoid shared mutable state. * @@ -76,6 +76,7 @@ public static XTrimArgs maxlen(long count) { public static XTrimArgs minId(String minid) { return new XTrimArgs().minId(minid); } + } /** diff --git a/src/main/java/io/lettuce/core/api/StatefulConnection.java b/src/main/java/io/lettuce/core/api/StatefulConnection.java index de403c591a..b318dd4b83 100644 --- a/src/main/java/io/lettuce/core/api/StatefulConnection.java +++ b/src/main/java/io/lettuce/core/api/StatefulConnection.java @@ -114,8 +114,8 @@ public interface StatefulConnection extends AutoCloseable, AsyncCloseable void reset(); /** - * Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands - * can be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is + * Disable or enable auto-flush behavior. Default is {@code true}. If autoFlushCommands is disabled, multiple commands can + * be issued without writing them actually to the transport. Commands are buffered until a {@link #flushCommands()} is * issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis. * * @param autoFlush state of autoFlush. diff --git a/src/main/java/io/lettuce/core/api/async/RedisAclAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisAclAsyncCommands.java index 633beffc48..4b76550deb 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisAclAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisAclAsyncCommands.java @@ -113,8 +113,8 @@ public interface RedisAclAsyncCommands { RedisFuture> aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -143,8 +143,8 @@ public interface RedisAclAsyncCommands { RedisFuture aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -172,4 +172,5 @@ public interface RedisAclAsyncCommands { * @return K bulk-string-reply the username of the current connection. */ RedisFuture aclWhoami(); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java index 90632b731a..3b834db942 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisGeoAsyncCommands.java @@ -162,7 +162,8 @@ public interface RedisGeoAsyncCommands { * @param geoArgs args to control the result. * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. */ - RedisFuture>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoArgs geoArgs); + RedisFuture>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoArgs geoArgs); /** * Perform a {@link #georadius(Object, double, double, double, GeoArgs.Unit, GeoArgs)} query and store the results in a @@ -177,7 +178,8 @@ public interface RedisGeoAsyncCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - RedisFuture georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + RedisFuture georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** * Retrieve members selected by distance with the center of {@code member}. The member itself is always contained in the @@ -216,11 +218,12 @@ public interface RedisGeoAsyncCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - RedisFuture georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + RedisFuture georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -231,8 +234,8 @@ public interface RedisGeoAsyncCommands { RedisFuture> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -241,7 +244,8 @@ public interface RedisGeoAsyncCommands { * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. * @since 6.1 */ - RedisFuture>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs); + RedisFuture>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs); /** * Perform a {@link #geosearch(Object, GeoSearch.GeoRef, GeoSearch.GeoPredicate, GeoArgs)} query and store the results in a @@ -252,9 +256,12 @@ public interface RedisGeoAsyncCommands { * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ - RedisFuture geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist); + RedisFuture geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs, boolean storeDist); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisHLLAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisHLLAsyncCommands.java index c9a8cf9bd5..58b481d1ba 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisHLLAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisHLLAsyncCommands.java @@ -61,4 +61,5 @@ public interface RedisHLLAsyncCommands { * The approximated number of unique elements observed via {@code PFADD}. */ RedisFuture pfcount(K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java index 9f514450fa..374f9e2348 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java @@ -336,7 +336,8 @@ public interface RedisHashAsyncCommands { * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. */ - RedisFuture hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + RedisFuture hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate hash fields, without associated values. @@ -348,7 +349,8 @@ public interface RedisHashAsyncCommands { * @return StreamScanCursor scan cursor. * @since 7.0 */ - RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate hash fields and associated values. @@ -581,4 +583,5 @@ public interface RedisHashAsyncCommands { * associated timeout. */ RedisFuture hpersist(K key, K... fields); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java index 76b1fe3f89..1367b489f2 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java @@ -202,4 +202,5 @@ public interface RedisScriptingAsyncCommands { * @since 6.0 */ String digest(byte[] script); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisSetAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisSetAsyncCommands.java index 2caa9bdfdd..9bdc29d90c 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisSetAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisSetAsyncCommands.java @@ -342,4 +342,5 @@ public interface RedisSetAsyncCommands { * @return StreamScanCursor scan cursor. */ RedisFuture sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisSortedSetAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisSortedSetAsyncCommands.java index 6119585764..b1d19e8580 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisSortedSetAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisSortedSetAsyncCommands.java @@ -489,7 +489,8 @@ public interface RedisSortedSetAsyncCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -508,7 +509,8 @@ public interface RedisSortedSetAsyncCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -878,7 +880,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, long count); + RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -893,7 +896,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, long count); + RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -905,10 +909,12 @@ public interface RedisSortedSetAsyncCommands { * @return Long count of elements in the specified score range. * @since 4.3 */ - RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + RedisFuture zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -919,7 +925,8 @@ public interface RedisSortedSetAsyncCommands { RedisFuture zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -931,7 +938,8 @@ public interface RedisSortedSetAsyncCommands { RedisFuture zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1225,7 +1233,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. */ @Deprecated - RedisFuture zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min, long offset, long count); + RedisFuture zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min, long offset, + long count); /** * Stream over a range of members in a sorted set, by score, with scores ordered from high to low. @@ -1240,7 +1249,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. */ @Deprecated - RedisFuture zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min, long offset, long count); + RedisFuture zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min, long offset, + long count); /** * Stream over a range of members in a sorted set, by score, with scores ordered from high to low. @@ -1376,7 +1386,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, long count); + RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1391,7 +1402,8 @@ public interface RedisSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, long count); + RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1403,10 +1415,12 @@ public interface RedisSortedSetAsyncCommands { * @return Long count of elements in the specified range. * @since 4.3 */ - RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + RedisFuture zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1417,7 +1431,8 @@ public interface RedisSortedSetAsyncCommands { RedisFuture zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1429,9 +1444,11 @@ public interface RedisSortedSetAsyncCommands { RedisFuture zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. @@ -1524,7 +1541,8 @@ public interface RedisSortedSetAsyncCommands { * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. */ - RedisFuture zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + RedisFuture zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate sorted sets elements and associated scores. @@ -1602,4 +1620,5 @@ public interface RedisSortedSetAsyncCommands { * @return Long integer-reply the number of elements in the resulting sorted set at {@code destination}. */ RedisFuture zunionstore(K destination, ZStoreArgs storeArgs, K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisStreamAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisStreamAsyncCommands.java index df6e81e1e7..317f02a195 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisStreamAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisStreamAsyncCommands.java @@ -368,4 +368,5 @@ public interface RedisStreamAsyncCommands { * @since 6.1 */ RedisFuture xtrim(K key, XTrimArgs args); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisStringAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisStringAsyncCommands.java index c3ea91fb92..1e5b1d3d05 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisStringAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisStringAsyncCommands.java @@ -433,4 +433,5 @@ public interface RedisStringAsyncCommands { * @return Long integer-reply the length of the string at {@code key}, or {@code 0} when {@code key} does not exist. */ RedisFuture strlen(K key); + } diff --git a/src/main/java/io/lettuce/core/api/async/RedisTransactionalAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisTransactionalAsyncCommands.java index 4378632c49..3c6d25adea 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisTransactionalAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisTransactionalAsyncCommands.java @@ -72,4 +72,5 @@ public interface RedisTransactionalAsyncCommands { * @return String simple-string-reply always {@code OK}. */ RedisFuture unwatch(); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java index 24d9989efa..43fd4ec538 100644 --- a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java @@ -79,7 +79,7 @@ public interface BaseRedisReactiveCommands { Flux pubsubShardChannels(); /** - * Lists the currently *active shard channels*. + * Lists the currently *active shard channels*. * * @param pattern the pattern type: patternkey (pattern). * @return K array-reply a list of active channels, optionally matching the specified pattern. @@ -123,8 +123,8 @@ public interface BaseRedisReactiveCommands { /** * Return the role of the instance in the context of replication. * - * @return Object array-reply where the first element is one of master, slave, sentinel and the additional - * elements are role-specific. + * @return Object array-reply where the first element is one of master, slave, sentinel and the additional elements are + * role-specific. */ Flux role(); diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisAclReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisAclReactiveCommands.java index d389a69a4e..27772cc01c 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisAclReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisAclReactiveCommands.java @@ -114,8 +114,8 @@ public interface RedisAclReactiveCommands { Flux aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -144,8 +144,8 @@ public interface RedisAclReactiveCommands { Mono aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -173,4 +173,5 @@ public interface RedisAclReactiveCommands { * @return K bulk-string-reply the username of the current connection. */ Mono aclWhoami(); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java index 866025cf90..d241878131 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisGeoReactiveCommands.java @@ -175,7 +175,8 @@ public interface RedisGeoReactiveCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - Mono georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + Mono georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** * Retrieve members selected by distance with the center of {@code member}. The member itself is always contained in the @@ -217,8 +218,8 @@ public interface RedisGeoReactiveCommands { Mono georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -229,8 +230,8 @@ public interface RedisGeoReactiveCommands { Flux geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -250,9 +251,12 @@ public interface RedisGeoReactiveCommands { * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ - Mono geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist); + Mono geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs, boolean storeDist); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisHLLReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisHLLReactiveCommands.java index a371585f8c..3df1188651 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisHLLReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisHLLReactiveCommands.java @@ -42,4 +42,5 @@ public interface RedisHLLReactiveCommands { * The approximated number of unique elements observed via {@code PFADD}. */ Mono pfcount(K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java index e02fe5b80a..bd90160ede 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java @@ -115,7 +115,8 @@ public interface RedisHashReactiveCommands { * @param channel the channel. * @param key the key. * @return Long count of the keys. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hgetall}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hgetall}. */ @Deprecated Mono hgetall(KeyValueStreamingChannel channel, K key); @@ -134,7 +135,8 @@ public interface RedisHashReactiveCommands { * @param channel the channel. * @param key the key. * @return Long count of the keys. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hkeys}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hkeys}. */ @Deprecated Mono hkeys(KeyStreamingChannel channel, K key); @@ -163,7 +165,8 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param fields the fields. * @return Long count of the keys. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hmget}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hmget}. */ @Deprecated Mono hmget(KeyValueStreamingChannel channel, K key, K... fields); @@ -301,7 +304,8 @@ public interface RedisHashReactiveCommands { * @param channel streaming channel that receives a call for every key-value pair. * @param key the key. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscan}. */ @Deprecated Mono hscan(KeyValueStreamingChannel channel, K key); @@ -312,7 +316,8 @@ public interface RedisHashReactiveCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscanNovalues}. + * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscanNovalues}. */ @Deprecated Mono hscanNovalues(KeyStreamingChannel channel, K key); @@ -324,7 +329,8 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscan}. */ @Deprecated Mono hscan(KeyValueStreamingChannel channel, K key, ScanArgs scanArgs); @@ -336,7 +342,8 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscanNovalues}. + * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscanNovalues}. */ @Deprecated Mono hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -349,7 +356,8 @@ public interface RedisHashReactiveCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscan}. */ @Deprecated Mono hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -362,7 +370,8 @@ public interface RedisHashReactiveCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscanNovalues}. + * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscanNovalues}. */ @Deprecated Mono hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -374,7 +383,8 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscan}. */ @Deprecated Mono hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor); @@ -386,7 +396,8 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hscanNovalues}. + * @deprecated since 7.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hscanNovalues}. */ @Deprecated Mono hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -451,7 +462,8 @@ public interface RedisHashReactiveCommands { * @param channel streaming channel that receives a call for every value. * @param key the key. * @return Long count of the keys. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #hvals}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #hvals}. */ @Deprecated Mono hvals(ValueStreamingChannel channel, K key); @@ -603,4 +615,5 @@ public interface RedisHashReactiveCommands { * associated timeout. */ Mono hpersist(K key, K... fields); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java index 749ef60959..0272f0cda0 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java @@ -137,9 +137,9 @@ public interface RedisScriptingReactiveCommands { * Check existence of scripts in the script cache. * * @param digests script digests. - * @return Boolean array-reply The command returns an array of integers that correspond to the specified SHA1 - * digest arguments. For every corresponding SHA1 digest of a script that actually exists in the script cache, an 1 - * is returned, otherwise 0 is returned. + * @return Boolean array-reply The command returns an array of integers that correspond to the specified SHA1 digest + * arguments. For every corresponding SHA1 digest of a script that actually exists in the script cache, an 1 is + * returned, otherwise 0 is returned. */ Flux scriptExists(String... digests); @@ -201,4 +201,5 @@ public interface RedisScriptingReactiveCommands { * @since 6.0 */ String digest(byte[] script); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisSetReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisSetReactiveCommands.java index fb6f1fae29..d186af9af5 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisSetReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisSetReactiveCommands.java @@ -71,7 +71,8 @@ public interface RedisSetReactiveCommands { * @param channel the channel. * @param keys the keys. * @return Long count of members of the resulting set. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sdiff}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sdiff}. */ @Deprecated Mono sdiff(ValueStreamingChannel channel, K... keys); @@ -99,7 +100,8 @@ public interface RedisSetReactiveCommands { * @param channel the channel. * @param keys the keys. * @return Long count of members of the resulting set. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sinter}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sinter}. */ @Deprecated Mono sinter(ValueStreamingChannel channel, K... keys); @@ -161,7 +163,8 @@ public interface RedisSetReactiveCommands { * @param channel the channel. * @param key the keys. * @return Long count of members of the resulting set. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #smembers}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #smembers}. */ @Deprecated Mono smembers(ValueStreamingChannel channel, K key); @@ -171,8 +174,8 @@ public interface RedisSetReactiveCommands { * * @param key the key. * @param members the member type: value. - * @return Boolean array-reply list representing the membership of the given elements, in the same order as they - * are requested. + * @return Boolean array-reply list representing the membership of the given elements, in the same order as they are + * requested. * @since 6.1 */ Flux smismember(K key, V... members); @@ -221,8 +224,8 @@ public interface RedisSetReactiveCommands { * * @param key the key. * @param count the count type: long. - * @return V bulk-string-reply without the additional {@code count} argument the command returns a Bulk Reply - * with the randomly selected element, or {@code null} when {@code key} does not exist. + * @return V bulk-string-reply without the additional {@code count} argument the command returns a Bulk Reply with the + * randomly selected element, or {@code null} when {@code key} does not exist. */ Flux srandmember(K key, long count); @@ -233,7 +236,8 @@ public interface RedisSetReactiveCommands { * @param key the key. * @param count the count. * @return Long count of members of the resulting set. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #srandmember}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #srandmember}. */ @Deprecated Mono srandmember(ValueStreamingChannel channel, K key, long count); @@ -261,7 +265,8 @@ public interface RedisSetReactiveCommands { * @param channel streaming channel that receives a call for every value. * @param keys the keys. * @return Long count of members of the resulting set. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sunion}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sunion}. */ @Deprecated Mono sunion(ValueStreamingChannel channel, K... keys); @@ -317,7 +322,8 @@ public interface RedisSetReactiveCommands { * @param channel streaming channel that receives a call for every value. * @param key the key. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sscan}. */ @Deprecated Mono sscan(ValueStreamingChannel channel, K key); @@ -329,7 +335,8 @@ public interface RedisSetReactiveCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sscan}. */ @Deprecated Mono sscan(ValueStreamingChannel channel, K key, ScanArgs scanArgs); @@ -342,7 +349,8 @@ public interface RedisSetReactiveCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sscan}. */ @Deprecated Mono sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -354,8 +362,10 @@ public interface RedisSetReactiveCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #sscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #sscan}. */ @Deprecated Mono sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisSortedSetReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisSortedSetReactiveCommands.java index 980c416a25..01fef6392e 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisSortedSetReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisSortedSetReactiveCommands.java @@ -490,7 +490,8 @@ public interface RedisSortedSetReactiveCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return ScoredValue<V> array-reply list of scores and elements. * @since 6.1 */ @@ -509,7 +510,8 @@ public interface RedisSortedSetReactiveCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return ScoredValue<V> array-reply list of scores and elements. * @since 6.1 */ @@ -533,7 +535,8 @@ public interface RedisSortedSetReactiveCommands { * @param start the start. * @param stop the stop. * @return Long count of elements in the specified range. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrange}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrange}. */ @Deprecated Mono zrange(ValueStreamingChannel channel, K key, long start, long stop); @@ -556,7 +559,8 @@ public interface RedisSortedSetReactiveCommands { * @param start the start. * @param stop the stop. * @return Long count of elements in the specified range. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangeWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangeWithScores}. */ @Deprecated Mono zrangeWithScores(ScoredValueStreamingChannel channel, K key, long start, long stop); @@ -690,7 +694,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, double min, double max); @@ -704,7 +709,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, String min, String max); @@ -717,7 +723,8 @@ public interface RedisSortedSetReactiveCommands { * @param range the range. * @return Long count of elements in the specified score range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, Range range); @@ -733,7 +740,8 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range, Limit limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, double min, double max, long offset, long count); @@ -749,7 +757,8 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range, Limit limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, String min, String max, long offset, long count); @@ -763,7 +772,8 @@ public interface RedisSortedSetReactiveCommands { * @param limit the limit. * @return Long count of elements in the specified score range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscore}. */ @Deprecated Mono zrangebyscore(ValueStreamingChannel channel, K key, Range range, Limit limit); @@ -850,7 +860,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max); @@ -864,7 +875,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max); @@ -877,7 +889,8 @@ public interface RedisSortedSetReactiveCommands { * @param range the range. * @return Long count of elements in the specified score range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range); @@ -893,10 +906,12 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated - Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, long count); + Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -909,10 +924,12 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified score range. * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated - Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, long count); + Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -923,13 +940,16 @@ public interface RedisSortedSetReactiveCommands { * @param limit the limit. * @return Long count of elements in the specified score range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrangebyscoreWithScores}. */ @Deprecated - Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + Mono zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -940,7 +960,8 @@ public interface RedisSortedSetReactiveCommands { Mono zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -952,7 +973,8 @@ public interface RedisSortedSetReactiveCommands { Mono zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1078,7 +1100,8 @@ public interface RedisSortedSetReactiveCommands { * @param start the start. * @param stop the stop. * @return Long count of elements in the specified range. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrange}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrange}. */ @Deprecated Mono zrevrange(ValueStreamingChannel channel, K key, long start, long stop); @@ -1101,7 +1124,8 @@ public interface RedisSortedSetReactiveCommands { * @param start the start. * @param stop the stop. * @return Long count of elements in the specified range. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangeWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangeWithScores}. */ @Deprecated Mono zrevrangeWithScores(ScoredValueStreamingChannel channel, K key, long start, long stop); @@ -1209,7 +1233,8 @@ public interface RedisSortedSetReactiveCommands { * @param min min score. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscore(java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min); @@ -1223,7 +1248,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscore(java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min); @@ -1236,7 +1262,8 @@ public interface RedisSortedSetReactiveCommands { * @param range the range. * @return Long count of elements in the specified range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, Range range); @@ -1252,7 +1279,8 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min, long offset, long count); @@ -1268,7 +1296,8 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min, long offset, long count); @@ -1282,7 +1311,8 @@ public interface RedisSortedSetReactiveCommands { * @param limit the limit. * @return Long count of elements in the specified range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscore}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscore}. */ @Deprecated Mono zrevrangebyscore(ValueStreamingChannel channel, K key, Range range, Limit limit); @@ -1369,7 +1399,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min); @@ -1383,7 +1414,8 @@ public interface RedisSortedSetReactiveCommands { * @param max max score. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min); @@ -1395,7 +1427,8 @@ public interface RedisSortedSetReactiveCommands { * @param key the key. * @param range the range. * @return Long count of elements in the specified range. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range); @@ -1411,10 +1444,12 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated - Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, long count); + Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1427,10 +1462,12 @@ public interface RedisSortedSetReactiveCommands { * @param count the count. * @return Long count of elements in the specified range. * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated - Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, long count); + Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1441,13 +1478,16 @@ public interface RedisSortedSetReactiveCommands { * @param limit the limit. * @return Long count of elements in the specified range. * @since 4.3 - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zrevrangebyscoreWithScores}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zrevrangebyscoreWithScores}. */ @Deprecated - Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + Mono zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1458,7 +1498,8 @@ public interface RedisSortedSetReactiveCommands { Mono zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1470,9 +1511,11 @@ public interface RedisSortedSetReactiveCommands { Mono zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. @@ -1543,7 +1586,8 @@ public interface RedisSortedSetReactiveCommands { * @param channel streaming channel that receives a call for every scored value. * @param key the key. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zscan}. */ @Deprecated Mono zscan(ScoredValueStreamingChannel channel, K key); @@ -1555,7 +1599,8 @@ public interface RedisSortedSetReactiveCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zscan}. */ @Deprecated Mono zscan(ScoredValueStreamingChannel channel, K key, ScanArgs scanArgs); @@ -1568,7 +1613,8 @@ public interface RedisSortedSetReactiveCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zscan}. */ @Deprecated Mono zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -1580,7 +1626,8 @@ public interface RedisSortedSetReactiveCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #zscan}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #zscan}. */ @Deprecated Mono zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor); @@ -1651,4 +1698,5 @@ public interface RedisSortedSetReactiveCommands { * @return Long integer-reply the number of elements in the resulting sorted set at {@code destination}. */ Mono zunionstore(K destination, ZStoreArgs storeArgs, K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisStreamReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisStreamReactiveCommands.java index 4ef801e5ab..e0e5534996 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisStreamReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisStreamReactiveCommands.java @@ -369,4 +369,5 @@ public interface RedisStreamReactiveCommands { * @since 6.1 */ Mono xtrim(K key, XTrimArgs args); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisStringReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisStringReactiveCommands.java index f96a00d94d..817c235375 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisStringReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisStringReactiveCommands.java @@ -296,7 +296,8 @@ public interface RedisStringReactiveCommands { * @param channel the channel. * @param keys the keys. * @return Long array-reply list of values at the specified keys. - * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by {@link #mget}. + * @deprecated since 6.0 in favor of consuming large results through the {@link org.reactivestreams.Publisher} returned by + * {@link #mget}. */ @Deprecated Mono mget(KeyValueStreamingChannel channel, K... keys); @@ -436,4 +437,5 @@ public interface RedisStringReactiveCommands { * @return Long integer-reply the length of the string at {@code key}, or {@code 0} when {@code key} does not exist. */ Mono strlen(K key); + } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisTransactionalReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisTransactionalReactiveCommands.java index abb72e150b..3c4da45792 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisTransactionalReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisTransactionalReactiveCommands.java @@ -53,4 +53,5 @@ public interface RedisTransactionalReactiveCommands { * @return String simple-string-reply always {@code OK}. */ Mono unwatch(); + } diff --git a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java index ce942334ed..8082e84521 100644 --- a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java @@ -76,7 +76,7 @@ public interface BaseRedisCommands { * @return List<K> array-reply a list of active channels. */ List pubsubShardChannels(); - + /** * Lists the currently *active shard channels*. * @@ -84,7 +84,7 @@ public interface BaseRedisCommands { * @return List<K> array-reply a list of active channels, optionally matching the specified pattern. */ List pubsubShardChannels(K pattern); - + /** * Returns the number of subscribers (not counting clients subscribed to patterns) for the specified shard channels. * @@ -204,4 +204,5 @@ public interface BaseRedisCommands { */ @Deprecated void reset(); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisAclCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisAclCommands.java index aea491eba7..3be8308f39 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisAclCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisAclCommands.java @@ -112,8 +112,8 @@ public interface RedisAclCommands { List aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -142,8 +142,8 @@ public interface RedisAclCommands { String aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -171,4 +171,5 @@ public interface RedisAclCommands { * @return K bulk-string-reply the username of the current connection. */ String aclWhoami(); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java index ea6f96cf90..56712babf0 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisGeoCommands.java @@ -176,7 +176,8 @@ public interface RedisGeoCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - Long georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + Long georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** * Retrieve members selected by distance with the center of {@code member}. The member itself is always contained in the @@ -218,8 +219,8 @@ public interface RedisGeoCommands { Long georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -230,8 +231,8 @@ public interface RedisGeoCommands { Set geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -251,9 +252,12 @@ public interface RedisGeoCommands { * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ - Long geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist); + Long geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, + boolean storeDist); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisHLLCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisHLLCommands.java index cae160a802..7228c1d5cb 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisHLLCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisHLLCommands.java @@ -59,4 +59,5 @@ public interface RedisHLLCommands { * The approximated number of unique elements observed via {@code PFADD}. */ Long pfcount(K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java index ab41a1cafd..f27d96e0c6 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java @@ -582,4 +582,5 @@ public interface RedisHashCommands { * associated timeout. */ Boolean hpersist(K key, K... fields); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java index 19425de304..cc359cb42a 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java @@ -201,4 +201,5 @@ public interface RedisScriptingCommands { * @since 6.0 */ String digest(byte[] script); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisSetCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisSetCommands.java index c78e36bfbc..f67a792e3d 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisSetCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisSetCommands.java @@ -341,4 +341,5 @@ public interface RedisSetCommands { * @return StreamScanCursor scan cursor. */ StreamScanCursor sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisSortedSetCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisSortedSetCommands.java index 05e3ddcf1f..43bc1c98be 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisSortedSetCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisSortedSetCommands.java @@ -488,7 +488,8 @@ public interface RedisSortedSetCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -507,7 +508,8 @@ public interface RedisSortedSetCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -877,7 +879,8 @@ public interface RedisSortedSetCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, long count); + Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -892,7 +895,8 @@ public interface RedisSortedSetCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, long count); + Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -907,7 +911,8 @@ public interface RedisSortedSetCommands { Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -918,7 +923,8 @@ public interface RedisSortedSetCommands { Long zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -930,7 +936,8 @@ public interface RedisSortedSetCommands { Long zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1375,7 +1382,8 @@ public interface RedisSortedSetCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, long count); + Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1390,7 +1398,8 @@ public interface RedisSortedSetCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, long count); + Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1405,7 +1414,8 @@ public interface RedisSortedSetCommands { Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1416,7 +1426,8 @@ public interface RedisSortedSetCommands { Long zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1428,9 +1439,11 @@ public interface RedisSortedSetCommands { Long zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. @@ -1601,4 +1614,5 @@ public interface RedisSortedSetCommands { * @return Long integer-reply the number of elements in the resulting sorted set at {@code destination}. */ Long zunionstore(K destination, ZStoreArgs storeArgs, K... keys); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisStreamCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisStreamCommands.java index 0632e21074..68ed5ab897 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisStreamCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisStreamCommands.java @@ -368,4 +368,5 @@ public interface RedisStreamCommands { * @since 6.1 */ Long xtrim(K key, XTrimArgs args); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisStringCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisStringCommands.java index 5edc4ee2e6..03280bf924 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisStringCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisStringCommands.java @@ -432,4 +432,5 @@ public interface RedisStringCommands { * @return Long integer-reply the length of the string at {@code key}, or {@code 0} when {@code key} does not exist. */ Long strlen(K key); + } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisTransactionalCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisTransactionalCommands.java index 0cf2b2e3ca..a291f55118 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisTransactionalCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisTransactionalCommands.java @@ -71,4 +71,5 @@ public interface RedisTransactionalCommands { * @return String simple-string-reply always {@code OK}. */ String unwatch(); + } diff --git a/src/main/java/io/lettuce/core/cluster/ClusterClientOptions.java b/src/main/java/io/lettuce/core/cluster/ClusterClientOptions.java index edf9f952f2..11b90828fb 100644 --- a/src/main/java/io/lettuce/core/cluster/ClusterClientOptions.java +++ b/src/main/java/io/lettuce/core/cluster/ClusterClientOptions.java @@ -353,13 +353,11 @@ public ClusterClientOptions.Builder mutate() { Builder builder = new Builder(); - builder.autoReconnect(isAutoReconnect()) - .cancelCommandsOnReconnectFailure(isCancelCommandsOnReconnectFailure()) - .decodeBufferPolicy(getDecodeBufferPolicy()) - .disconnectedBehavior(getDisconnectedBehavior()).maxRedirects(getMaxRedirects()) - .publishOnScheduler(isPublishOnScheduler()).pingBeforeActivateConnection(isPingBeforeActivateConnection()) - .protocolVersion(getConfiguredProtocolVersion()).readOnlyCommands(getReadOnlyCommands()) - .requestQueueSize(getRequestQueueSize()) + builder.autoReconnect(isAutoReconnect()).cancelCommandsOnReconnectFailure(isCancelCommandsOnReconnectFailure()) + .decodeBufferPolicy(getDecodeBufferPolicy()).disconnectedBehavior(getDisconnectedBehavior()) + .maxRedirects(getMaxRedirects()).publishOnScheduler(isPublishOnScheduler()) + .pingBeforeActivateConnection(isPingBeforeActivateConnection()).protocolVersion(getConfiguredProtocolVersion()) + .readOnlyCommands(getReadOnlyCommands()).requestQueueSize(getRequestQueueSize()) .scriptCharset(getScriptCharset()).socketOptions(getSocketOptions()).sslOptions(getSslOptions()) .suspendReconnectOnProtocolFailure(isSuspendReconnectOnProtocolFailure()).timeoutOptions(getTimeoutOptions()) .topologyRefreshOptions(getTopologyRefreshOptions()) @@ -410,7 +408,6 @@ public Duration getRefreshPeriod() { return topologyRefreshOptions.getRefreshPeriod(); } - /** * The {@link ClusterTopologyRefreshOptions} for detailed control of topology updates. * diff --git a/src/main/java/io/lettuce/core/cluster/DynamicNodeSelection.java b/src/main/java/io/lettuce/core/cluster/DynamicNodeSelection.java index 2f2b89b6a8..592699e12b 100644 --- a/src/main/java/io/lettuce/core/cluster/DynamicNodeSelection.java +++ b/src/main/java/io/lettuce/core/cluster/DynamicNodeSelection.java @@ -50,7 +50,7 @@ class DynamicNodeSelection extends AbstractNodeSelection, API> apiExtractor; public DynamicNodeSelection(ClusterDistributionChannelWriter writer, Predicate selector, - ConnectionIntent connectionIntent, Function, API> apiExtractor) { + ConnectionIntent connectionIntent, Function, API> apiExtractor) { this.selector = selector; this.connectionIntent = connectionIntent; diff --git a/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java b/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java index 2e74091a5e..a60dfd0d82 100644 --- a/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java +++ b/src/main/java/io/lettuce/core/cluster/RedisClusterClient.java @@ -684,7 +684,8 @@ private CompletableFuture> connectCl .onErrorResume(t -> connect(socketAddressSupplier, endpoint, connection, commandHandlerSupplier)); } - return connectionMono.doOnNext( + return connectionMono + .doOnNext( c -> connection.registerCloseables(closeableResources, clusterWriter, pooledClusterConnectionProvider)) .map(it -> (StatefulRedisClusterConnection) it).toFuture(); } diff --git a/src/main/java/io/lettuce/core/cluster/StaticNodeSelection.java b/src/main/java/io/lettuce/core/cluster/StaticNodeSelection.java index 6872cbc41d..fa58315d05 100644 --- a/src/main/java/io/lettuce/core/cluster/StaticNodeSelection.java +++ b/src/main/java/io/lettuce/core/cluster/StaticNodeSelection.java @@ -50,7 +50,7 @@ class StaticNodeSelection extends AbstractNodeSelection, API> apiExtractor; public StaticNodeSelection(ClusterDistributionChannelWriter writer, Predicate selector, - ConnectionIntent connectionIntent, Function, API> apiExtractor) { + ConnectionIntent connectionIntent, Function, API> apiExtractor) { this.writer = writer; this.connectionIntent = connectionIntent; diff --git a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java index dbdc2744f4..795a3f0848 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java @@ -78,7 +78,7 @@ public interface BaseNodeSelectionAsyncCommands { */ AsyncExecutions> pubsubShardChannels(); - /** + /** * Lists the currently *active shard channels*. * * @param pattern the pattern type: patternkey (pattern). @@ -203,4 +203,5 @@ public interface BaseNodeSelectionAsyncCommands { */ AsyncExecutions dispatch(ProtocolKeyword type, Supplier> outputSupplier, CommandArgs args); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionAclAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionAclAsyncCommands.java index 80a851d81c..6ac20b7d3d 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionAclAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionAclAsyncCommands.java @@ -112,8 +112,8 @@ public interface NodeSelectionAclAsyncCommands { AsyncExecutions> aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -142,8 +142,8 @@ public interface NodeSelectionAclAsyncCommands { AsyncExecutions aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -171,4 +171,5 @@ public interface NodeSelectionAclAsyncCommands { * @return K bulk-string-reply the username of the current connection. */ AsyncExecutions aclWhoami(); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java index 8d322888b8..0b92bf83ba 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionGeoAsyncCommands.java @@ -161,7 +161,8 @@ public interface NodeSelectionGeoAsyncCommands { * @param geoArgs args to control the result. * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. */ - AsyncExecutions>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoArgs geoArgs); + AsyncExecutions>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoArgs geoArgs); /** * Perform a {@link #georadius(Object, double, double, double, GeoArgs.Unit, GeoArgs)} query and store the results in a @@ -176,7 +177,8 @@ public interface NodeSelectionGeoAsyncCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - AsyncExecutions georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + AsyncExecutions georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** * Retrieve members selected by distance with the center of {@code member}. The member itself is always contained in the @@ -215,11 +217,12 @@ public interface NodeSelectionGeoAsyncCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - AsyncExecutions georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + AsyncExecutions georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -230,8 +233,8 @@ public interface NodeSelectionGeoAsyncCommands { AsyncExecutions> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -240,7 +243,8 @@ public interface NodeSelectionGeoAsyncCommands { * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. * @since 6.1 */ - AsyncExecutions>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs); + AsyncExecutions>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs); /** * Perform a {@link #geosearch(Object, GeoSearch.GeoRef, GeoSearch.GeoPredicate, GeoArgs)} query and store the results in a @@ -251,9 +255,12 @@ public interface NodeSelectionGeoAsyncCommands { * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ - AsyncExecutions geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist); + AsyncExecutions geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs, boolean storeDist); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHLLAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHLLAsyncCommands.java index c6ed931865..b30a4e8290 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHLLAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHLLAsyncCommands.java @@ -59,4 +59,5 @@ public interface NodeSelectionHLLAsyncCommands { * The approximated number of unique elements observed via {@code PFADD}. */ AsyncExecutions pfcount(K... keys); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java index 442444c6ed..4b020c3663 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java @@ -335,7 +335,8 @@ public interface NodeSelectionHashAsyncCommands { * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. */ - AsyncExecutions hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + AsyncExecutions hscan(KeyValueStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate hash fields, without associated values. @@ -347,7 +348,8 @@ public interface NodeSelectionHashAsyncCommands { * @return StreamScanCursor scan cursor. * @since 7.0 */ - AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate hash fields and associated values. @@ -580,4 +582,5 @@ public interface NodeSelectionHashAsyncCommands { * associated timeout. */ AsyncExecutions hpersist(K key, K... fields); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java index 746ae61d52..e116ce20b4 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java @@ -25,8 +25,8 @@ import io.lettuce.core.ScriptOutputType; /** - * Asynchronous executed commands on a node selection for Scripting. {@link java.lang.String Lua scripts} are encoded by using the configured - * {@link io.lettuce.core.ClientOptions#getScriptCharset() charset}. + * Asynchronous executed commands on a node selection for Scripting. {@link java.lang.String Lua scripts} are encoded by using + * the configured {@link io.lettuce.core.ClientOptions#getScriptCharset() charset}. * * @param Key type. * @param Value type. @@ -183,4 +183,5 @@ public interface NodeSelectionScriptingAsyncCommands { * @since 6.0 */ AsyncExecutions scriptLoad(byte[] script); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSetAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSetAsyncCommands.java index f80337a557..0b0864af72 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSetAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSetAsyncCommands.java @@ -341,4 +341,5 @@ public interface NodeSelectionSetAsyncCommands { * @return StreamScanCursor scan cursor. */ AsyncExecutions sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSortedSetAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSortedSetAsyncCommands.java index 14eb3a2551..b6b5663369 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSortedSetAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionSortedSetAsyncCommands.java @@ -488,7 +488,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -507,7 +508,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -725,7 +727,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - AsyncExecutions zrangebyscore(ValueStreamingChannel channel, K key, double min, double max, long offset, long count); + AsyncExecutions zrangebyscore(ValueStreamingChannel channel, K key, double min, double max, long offset, + long count); /** * Stream over a range of members in a sorted set, by score. @@ -740,7 +743,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscore(ValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - AsyncExecutions zrangebyscore(ValueStreamingChannel channel, K key, String min, String max, long offset, long count); + AsyncExecutions zrangebyscore(ValueStreamingChannel channel, K key, String min, String max, long offset, + long count); /** * Stream over a range of members in a sorted set, by score. @@ -877,7 +881,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, long count); + AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -892,7 +897,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, long count); + AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -904,10 +910,12 @@ public interface NodeSelectionSortedSetAsyncCommands { * @return Long count of elements in the specified score range. * @since 4.3 */ - AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + AsyncExecutions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -918,7 +926,8 @@ public interface NodeSelectionSortedSetAsyncCommands { AsyncExecutions zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -930,7 +939,8 @@ public interface NodeSelectionSortedSetAsyncCommands { AsyncExecutions zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1224,7 +1234,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. */ @Deprecated - AsyncExecutions zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min, long offset, long count); + AsyncExecutions zrevrangebyscore(ValueStreamingChannel channel, K key, double max, double min, long offset, + long count); /** * Stream over a range of members in a sorted set, by score, with scores ordered from high to low. @@ -1239,7 +1250,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(java.lang.Object, Range, Limit)}. */ @Deprecated - AsyncExecutions zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min, long offset, long count); + AsyncExecutions zrevrangebyscore(ValueStreamingChannel channel, K key, String max, String min, long offset, + long count); /** * Stream over a range of members in a sorted set, by score, with scores ordered from high to low. @@ -1360,7 +1372,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @param range the range. * @return Long count of elements in the specified range. */ - AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range); + AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, + Range range); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1375,7 +1388,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, long count); + AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1390,7 +1404,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, long count); + AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1402,10 +1417,12 @@ public interface NodeSelectionSortedSetAsyncCommands { * @return Long count of elements in the specified range. * @since 4.3 */ - AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + AsyncExecutions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, + Range range, Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1416,7 +1433,8 @@ public interface NodeSelectionSortedSetAsyncCommands { AsyncExecutions zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1428,9 +1446,11 @@ public interface NodeSelectionSortedSetAsyncCommands { AsyncExecutions zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. @@ -1523,7 +1543,8 @@ public interface NodeSelectionSortedSetAsyncCommands { * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. */ - AsyncExecutions zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); + AsyncExecutions zscan(ScoredValueStreamingChannel channel, K key, ScanCursor scanCursor, + ScanArgs scanArgs); /** * Incrementally iterate sorted sets elements and associated scores. @@ -1601,4 +1622,5 @@ public interface NodeSelectionSortedSetAsyncCommands { * @return Long integer-reply the number of elements in the resulting sorted set at {@code destination}. */ AsyncExecutions zunionstore(K destination, ZStoreArgs storeArgs, K... keys); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStreamAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStreamAsyncCommands.java index 06f6acf6d2..e6469db3a6 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStreamAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStreamAsyncCommands.java @@ -368,4 +368,5 @@ public interface NodeSelectionStreamAsyncCommands { * @since 6.1 */ AsyncExecutions xtrim(K key, XTrimArgs args); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStringAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStringAsyncCommands.java index 0897d9592b..1ee831ab69 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStringAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionStringAsyncCommands.java @@ -432,4 +432,5 @@ public interface NodeSelectionStringAsyncCommands { * @return Long integer-reply the length of the string at {@code key}, or {@code 0} when {@code key} does not exist. */ AsyncExecutions strlen(K key); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java index a1b8922c8d..d82031aa5d 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java @@ -147,4 +147,5 @@ public interface BaseNodeSelectionCommands { * @return number of replicas. */ Executions waitForReplication(int replicas, long timeout); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionAclCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionAclCommands.java index e99d88244d..5ce013525b 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionAclCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionAclCommands.java @@ -112,8 +112,8 @@ public interface NodeSelectionAclCommands { Executions> aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -142,8 +142,8 @@ public interface NodeSelectionAclCommands { Executions aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -171,4 +171,5 @@ public interface NodeSelectionAclCommands { * @return K bulk-string-reply the username of the current connection. */ Executions aclWhoami(); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java index e2f529f319..7ab66fb17c 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionGeoCommands.java @@ -161,7 +161,8 @@ public interface NodeSelectionGeoCommands { * @param geoArgs args to control the result. * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. */ - Executions>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoArgs geoArgs); + Executions>> georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoArgs geoArgs); /** * Perform a {@link #georadius(Object, double, double, double, GeoArgs.Unit, GeoArgs)} query and store the results in a @@ -176,7 +177,8 @@ public interface NodeSelectionGeoCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - Executions georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + Executions georadius(K key, double longitude, double latitude, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** * Retrieve members selected by distance with the center of {@code member}. The member itself is always contained in the @@ -215,11 +217,12 @@ public interface NodeSelectionGeoCommands { * their locations a sorted set. * @return Long integer-reply the number of elements in the result. */ - Executions georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); + Executions georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, + GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -230,8 +233,8 @@ public interface NodeSelectionGeoCommands { Executions> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -240,7 +243,8 @@ public interface NodeSelectionGeoCommands { * @return nested multi-bulk reply. The {@link GeoWithin} contains only fields which were requested by {@link GeoArgs}. * @since 6.1 */ - Executions>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs); + Executions>> geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs); /** * Perform a {@link #geosearch(Object, GeoSearch.GeoRef, GeoSearch.GeoPredicate, GeoArgs)} query and store the results in a @@ -251,9 +255,12 @@ public interface NodeSelectionGeoCommands { * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ - Executions geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, GeoArgs geoArgs, boolean storeDist); + Executions geosearchstore(K destination, K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate, + GeoArgs geoArgs, boolean storeDist); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHLLCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHLLCommands.java index fe789aacfd..a733133b79 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHLLCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHLLCommands.java @@ -59,4 +59,5 @@ public interface NodeSelectionHLLCommands { * The approximated number of unique elements observed via {@code PFADD}. */ Executions pfcount(K... keys); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java index f2aeaf52b4..9f23a2159d 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java @@ -580,4 +580,5 @@ public interface NodeSelectionHashCommands { * associated timeout. */ Executions hpersist(K key, K... fields); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java index f64078e375..e1c2306626 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java @@ -25,8 +25,8 @@ import io.lettuce.core.ScriptOutputType; /** - * Synchronous executed commands on a node selection for Scripting. {@link java.lang.String Lua scripts} are encoded by using the configured - * {@link io.lettuce.core.ClientOptions#getScriptCharset() charset}. + * Synchronous executed commands on a node selection for Scripting. {@link java.lang.String Lua scripts} are encoded by using + * the configured {@link io.lettuce.core.ClientOptions#getScriptCharset() charset}. * * @param Key type. * @param Value type. @@ -183,4 +183,5 @@ public interface NodeSelectionScriptingCommands { * @since 6.0 */ Executions scriptLoad(byte[] script); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSetCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSetCommands.java index ec8204c665..984a801529 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSetCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSetCommands.java @@ -341,4 +341,5 @@ public interface NodeSelectionSetCommands { * @return StreamScanCursor scan cursor. */ Executions sscan(ValueStreamingChannel channel, K key, ScanCursor scanCursor); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSortedSetCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSortedSetCommands.java index 4ea7fc2015..f2abb7e63b 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSortedSetCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSortedSetCommands.java @@ -488,7 +488,8 @@ public interface NodeSelectionSortedSetCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -507,7 +508,8 @@ public interface NodeSelectionSortedSetCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -877,7 +879,8 @@ public interface NodeSelectionSortedSetCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, long count); + Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double min, double max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -892,7 +895,8 @@ public interface NodeSelectionSortedSetCommands { * @deprecated Use {@link #zrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit limit)}. */ @Deprecated - Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, long count); + Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String min, String max, long offset, + long count); /** * Stream over a range of members with scores in a sorted set, by score. @@ -904,10 +908,12 @@ public interface NodeSelectionSortedSetCommands { * @return Long count of elements in the specified score range. * @since 4.3 */ - Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + Executions zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -918,7 +924,8 @@ public interface NodeSelectionSortedSetCommands { Executions zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -930,7 +937,8 @@ public interface NodeSelectionSortedSetCommands { Executions zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1375,7 +1383,8 @@ public interface NodeSelectionSortedSetCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, long offset, long count); + Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, double max, double min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1390,7 +1399,8 @@ public interface NodeSelectionSortedSetCommands { * @deprecated Use {@link #zrevrangebyscoreWithScores(ScoredValueStreamingChannel, java.lang.Object, Range, Limit)}. */ @Deprecated - Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, long offset, long count); + Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, String max, String min, + long offset, long count); /** * Stream over a range of members with scores in a sorted set, by score, with scores ordered from high to low. @@ -1402,10 +1412,12 @@ public interface NodeSelectionSortedSetCommands { * @return Long count of elements in the specified range. * @since 4.3 */ - Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); + Executions zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, + Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1416,7 +1428,8 @@ public interface NodeSelectionSortedSetCommands { Executions zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1428,9 +1441,11 @@ public interface NodeSelectionSortedSetCommands { Executions zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. @@ -1601,4 +1616,5 @@ public interface NodeSelectionSortedSetCommands { * @return Long integer-reply the number of elements in the resulting sorted set at {@code destination}. */ Executions zunionstore(K destination, ZStoreArgs storeArgs, K... keys); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStreamCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStreamCommands.java index 1d477eca73..342aa2cce3 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStreamCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStreamCommands.java @@ -368,4 +368,5 @@ public interface NodeSelectionStreamCommands { * @since 6.1 */ Executions xtrim(K key, XTrimArgs args); + } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStringCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStringCommands.java index 6ce1146973..47c80b004d 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStringCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionStringCommands.java @@ -432,4 +432,5 @@ public interface NodeSelectionStringCommands { * @return Long integer-reply the length of the string at {@code key}, or {@code 0} when {@code key} does not exist. */ Executions strlen(K key); + } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java index 482453df7c..93da2f5313 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java @@ -75,7 +75,7 @@ public interface RedisClusterPubSubListener { * @param message Message. * @since 7.0 */ - default void smessage(RedisClusterNode node, K shardChannel, V message){ + default void smessage(RedisClusterNode node, K shardChannel, V message) { message(node, shardChannel, message); } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/StatefulRedisClusterPubSubConnection.java b/src/main/java/io/lettuce/core/cluster/pubsub/StatefulRedisClusterPubSubConnection.java index 5c11ccb57b..d5d2528be8 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/StatefulRedisClusterPubSubConnection.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/StatefulRedisClusterPubSubConnection.java @@ -155,8 +155,7 @@ public interface StatefulRedisClusterPubSubConnection extends StatefulRedi *

* Node event propagation is disabled by default. * - * @param enabled {@code true} to enable node message propagation; {@code false} (default) to disable message - * propagation. + * @param enabled {@code true} to enable node message propagation; {@code false} (default) to disable message propagation. */ void setNodeMessagePropagation(boolean enabled); diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java index ee8630378e..512afbaabd 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java @@ -50,4 +50,5 @@ public interface NodeSelectionPubSubAsyncCommands { * @since 7.0 */ AsyncExecutions ssubscribe(K... shardChannels); + } diff --git a/src/main/java/io/lettuce/core/cluster/topology/Connections.java b/src/main/java/io/lettuce/core/cluster/topology/Connections.java index b142a5840b..68d7d1ca6c 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/Connections.java +++ b/src/main/java/io/lettuce/core/cluster/topology/Connections.java @@ -134,8 +134,7 @@ private Requests doRequest(Supplier> c entry.getValue().dispatch(timedCommand); requests.addRequest(entry.getKey(), timedCommand); } - } - finally { + } finally { lock.unlock(); } diff --git a/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java b/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java index 350978981d..cc9ba5c4cb 100644 --- a/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java +++ b/src/main/java/io/lettuce/core/cluster/topology/DefaultClusterTopologyRefresh.java @@ -131,8 +131,7 @@ public CompletionStage> loadViews(Iterable s .requestTopology(commandTimeoutNs, TimeUnit.NANOSECONDS).mergeWith(requestedTopology); Requests additionalInfo = newConnections.requestInfo(commandTimeoutNs, TimeUnit.NANOSECONDS) .mergeWith(requestedInfo); - return CompletableFuture - .allOf(additionalTopology.allCompleted(), additionalInfo.allCompleted()) + return CompletableFuture.allOf(additionalTopology.allCompleted(), additionalInfo.allCompleted()) .thenApplyAsync(ignore2 -> getNodeSpecificViews(additionalTopology, additionalInfo), clientResources.eventExecutorGroup()); }); diff --git a/src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java b/src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java index e6abbbb8db..ec89879e2f 100644 --- a/src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java +++ b/src/main/java/io/lettuce/core/dynamic/ReactiveTypes.java @@ -92,8 +92,8 @@ class ReactiveTypes { } /** - * Returns {@code true} if reactive support is available. More specifically, whether RxJava1/2 or Project Reactor - * libraries are on the class path. + * Returns {@code true} if reactive support is available. More specifically, whether RxJava1/2 or Project Reactor libraries + * are on the class path. * * @return {@code true} if reactive support is available. */ diff --git a/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java b/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java index dee035d813..ae2111f183 100644 --- a/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java +++ b/src/main/java/io/lettuce/core/dynamic/RedisCommandFactory.java @@ -155,8 +155,8 @@ public void setCommandOutputFactoryResolver(CommandOutputFactoryResolver command /** * Enables/disables command verification which checks the command name against Redis {@code COMMAND} and the argument count. * - * @param verifyCommandMethods {@code true} to enable command verification (default) or {@code false} to disable - * command verification. + * @param verifyCommandMethods {@code true} to enable command verification (default) or {@code false} to disable command + * verification. */ public void setVerifyCommandMethods(boolean verifyCommandMethods) { this.verifyCommandMethods = verifyCommandMethods; diff --git a/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java b/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java index 9d42d37b69..a2ecf48834 100644 --- a/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java +++ b/src/main/java/io/lettuce/core/dynamic/SimpleBatcher.java @@ -184,4 +184,5 @@ private List> prepareDefaultFlush(int consu private ArrayList newDrainTarget() { return new ArrayList<>(Math.max(0, Math.min(batchSize, queue.size()))); } + } diff --git a/src/main/java/io/lettuce/core/dynamic/parameter/MethodParametersAccessor.java b/src/main/java/io/lettuce/core/dynamic/parameter/MethodParametersAccessor.java index 9fd86220d9..7fcd34b5a7 100644 --- a/src/main/java/io/lettuce/core/dynamic/parameter/MethodParametersAccessor.java +++ b/src/main/java/io/lettuce/core/dynamic/parameter/MethodParametersAccessor.java @@ -58,12 +58,12 @@ public interface MethodParametersAccessor { int resolveParameterIndex(String name); /** - * Return {@code true} if the parameter at {@code index} is a bindable {@code null} value that requires a - * {@code null} value instead of being skipped. + * Return {@code true} if the parameter at {@code index} is a bindable {@code null} value that requires a {@code null} value + * instead of being skipped. * * @param index parameter index. - * @return {@code true} if the parameter at {@code index} is a bindable {@code null} value that requires a - * {@code null} value instead of being skipped. + * @return {@code true} if the parameter at {@code index} is a bindable {@code null} value that requires a {@code null} + * value instead of being skipped. */ boolean isBindableNullValue(int index); diff --git a/src/main/java/io/lettuce/core/event/connection/ConnectionEventSupport.java b/src/main/java/io/lettuce/core/event/connection/ConnectionEventSupport.java index 95d03a0278..ee720cd9c4 100644 --- a/src/main/java/io/lettuce/core/event/connection/ConnectionEventSupport.java +++ b/src/main/java/io/lettuce/core/event/connection/ConnectionEventSupport.java @@ -84,4 +84,5 @@ public String toString() { sb.append(']'); return sb.toString(); } + } diff --git a/src/main/java/io/lettuce/core/event/metrics/JfrCommandLatencyEvent.java b/src/main/java/io/lettuce/core/event/metrics/JfrCommandLatencyEvent.java index 89a1da416a..98e8135817 100644 --- a/src/main/java/io/lettuce/core/event/metrics/JfrCommandLatencyEvent.java +++ b/src/main/java/io/lettuce/core/event/metrics/JfrCommandLatencyEvent.java @@ -46,4 +46,5 @@ public JfrCommandLatencyEvent(CommandLatencyEvent commandLatencyEvent) { new JfrCommandLatency(commandLatencyId, commandMetrics).commit(); }); } + } diff --git a/src/main/java/io/lettuce/core/masterreplica/AutodiscoveryConnector.java b/src/main/java/io/lettuce/core/masterreplica/AutodiscoveryConnector.java index 93e00ad118..aad151858c 100644 --- a/src/main/java/io/lettuce/core/masterreplica/AutodiscoveryConnector.java +++ b/src/main/java/io/lettuce/core/masterreplica/AutodiscoveryConnector.java @@ -130,7 +130,8 @@ private Mono> initializeConnection(Re connectionProvider.setKnownNodes(nodes); - MasterReplicaChannelWriter channelWriter = new MasterReplicaChannelWriter(connectionProvider, redisClient.getResources(), redisClient.getOptions()); + MasterReplicaChannelWriter channelWriter = new MasterReplicaChannelWriter(connectionProvider, + redisClient.getResources(), redisClient.getOptions()); StatefulRedisMasterReplicaConnectionImpl connection = new StatefulRedisMasterReplicaConnectionImpl<>( channelWriter, codec, redisURI.getTimeout()); diff --git a/src/main/java/io/lettuce/core/masterreplica/Connections.java b/src/main/java/io/lettuce/core/masterreplica/Connections.java index 057655ab70..022b497eef 100644 --- a/src/main/java/io/lettuce/core/masterreplica/Connections.java +++ b/src/main/java/io/lettuce/core/masterreplica/Connections.java @@ -43,6 +43,7 @@ class Connections extends CompletableEventLatchSupport> connections = new TreeMap<>( ReplicaUtils.RedisURIComparator.INSTANCE); @@ -110,8 +111,7 @@ public boolean isEmpty() { try { lock.lock(); return this.connections.isEmpty(); - } - finally { + } finally { lock.unlock(); } } diff --git a/src/main/java/io/lettuce/core/masterreplica/SentinelConnector.java b/src/main/java/io/lettuce/core/masterreplica/SentinelConnector.java index 597efaa1b7..afda7cc573 100644 --- a/src/main/java/io/lettuce/core/masterreplica/SentinelConnector.java +++ b/src/main/java/io/lettuce/core/masterreplica/SentinelConnector.java @@ -94,6 +94,7 @@ private Mono> initializeConnection(Re public CompletableFuture closeAsync() { return CompletableFuture.allOf(super.closeAsync(), sentinelTopologyRefresh.closeAsync()); } + }; StatefulRedisMasterReplicaConnectionImpl connection = new StatefulRedisMasterReplicaConnectionImpl<>( diff --git a/src/main/java/io/lettuce/core/masterreplica/StaticMasterReplicaConnector.java b/src/main/java/io/lettuce/core/masterreplica/StaticMasterReplicaConnector.java index bff843c2f8..df9a33eeca 100644 --- a/src/main/java/io/lettuce/core/masterreplica/StaticMasterReplicaConnector.java +++ b/src/main/java/io/lettuce/core/masterreplica/StaticMasterReplicaConnector.java @@ -86,7 +86,8 @@ private Mono> initializeConnection(Re connectionProvider.setKnownNodes(nodes); - MasterReplicaChannelWriter channelWriter = new MasterReplicaChannelWriter(connectionProvider, redisClient.getResources(), redisClient.getOptions()); + MasterReplicaChannelWriter channelWriter = new MasterReplicaChannelWriter(connectionProvider, + redisClient.getResources(), redisClient.getOptions()); StatefulRedisMasterReplicaConnectionImpl connection = new StatefulRedisMasterReplicaConnectionImpl<>( channelWriter, codec, seedNode.getTimeout()); diff --git a/src/main/java/io/lettuce/core/metrics/CommandLatencyCollector.java b/src/main/java/io/lettuce/core/metrics/CommandLatencyCollector.java index 550949a599..22630cc3bb 100644 --- a/src/main/java/io/lettuce/core/metrics/CommandLatencyCollector.java +++ b/src/main/java/io/lettuce/core/metrics/CommandLatencyCollector.java @@ -63,4 +63,5 @@ public boolean isEnabled() { }; } + } diff --git a/src/main/java/io/lettuce/core/metrics/CommandLatencyCollectorOptions.java b/src/main/java/io/lettuce/core/metrics/CommandLatencyCollectorOptions.java index 61d5f5bcdd..bc23c5216e 100644 --- a/src/main/java/io/lettuce/core/metrics/CommandLatencyCollectorOptions.java +++ b/src/main/java/io/lettuce/core/metrics/CommandLatencyCollectorOptions.java @@ -91,10 +91,10 @@ static CommandLatencyCollectorOptions.Builder builder() { boolean resetLatenciesAfterEvent(); /** - * Returns whether to distinct latencies on local level. If {@code true}, multiple connections to the same - * host/connection point will be recorded separately which allows to inspect every connection individually. If - * {@code false}, multiple connections to the same host/connection point will be recorded together. This allows a - * consolidated view on one particular service. + * Returns whether to distinct latencies on local level. If {@code true}, multiple connections to the same host/connection + * point will be recorded separately which allows to inspect every connection individually. If {@code false}, multiple + * connections to the same host/connection point will be recorded together. This allows a consolidated view on one + * particular service. * * @return {@code true} if latencies are recorded distinct on local level (per connection) */ @@ -166,8 +166,8 @@ interface Builder { Builder localDistinction(boolean localDistinction); /** - * Sets whether the recorded latencies should be reset once the metrics event was emitted. Defaults to {@code true}. - * See {@link DefaultCommandLatencyCollectorOptions#DEFAULT_RESET_LATENCIES_AFTER_EVENT}. + * Sets whether the recorded latencies should be reset once the metrics event was emitted. Defaults to {@code true}. See + * {@link DefaultCommandLatencyCollectorOptions#DEFAULT_RESET_LATENCIES_AFTER_EVENT}. * * @param resetLatenciesAfterEvent {@code true} if the recorded latencies should be reset once the metrics event was * emitted. diff --git a/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptions.java b/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptions.java index 37ba6fafe4..5c5c1877d9 100644 --- a/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptions.java +++ b/src/main/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptions.java @@ -58,7 +58,6 @@ public class DefaultCommandLatencyCollectorOptions implements CommandLatencyColl private final Builder builder; - protected DefaultCommandLatencyCollectorOptions(Builder builder) { this.targetUnit = builder.targetUnit; this.targetPercentiles = builder.targetPercentiles; @@ -209,8 +208,8 @@ public Builder targetPercentiles(double[] targetPercentiles) { } /** - * Sets whether the recorded latencies should be reset once the metrics event was emitted. Defaults to {@code true}. - * See {@link DefaultCommandLatencyCollectorOptions#DEFAULT_RESET_LATENCIES_AFTER_EVENT}. + * Sets whether the recorded latencies should be reset once the metrics event was emitted. Defaults to {@code true}. See + * {@link DefaultCommandLatencyCollectorOptions#DEFAULT_RESET_LATENCIES_AFTER_EVENT}. * * @param resetLatenciesAfterEvent {@code true} if the recorded latencies should be reset once the metrics event was * emitted @@ -279,4 +278,5 @@ public boolean isEnabled() { public boolean usePauseDetector() { return usePauseDetector; } + } diff --git a/src/main/java/io/lettuce/core/models/command/CommandDetail.java b/src/main/java/io/lettuce/core/models/command/CommandDetail.java index a5407a8cc7..7ddf1c7667 100644 --- a/src/main/java/io/lettuce/core/models/command/CommandDetail.java +++ b/src/main/java/io/lettuce/core/models/command/CommandDetail.java @@ -79,7 +79,8 @@ public CommandDetail(String name, int arity, Set flags, int firstKeyPositi * @param aclCategories command ACL details * @since 6.1 */ - public CommandDetail(String name, int arity, Set flags, int firstKeyPosition, int lastKeyPosition, int keyStepCount, Set aclCategories) { + public CommandDetail(String name, int arity, Set flags, int firstKeyPosition, int lastKeyPosition, int keyStepCount, + Set aclCategories) { this.name = name; this.arity = arity; this.flags = flags; @@ -232,4 +233,5 @@ public enum Flag { */ MOVABLEKEYS; } + } diff --git a/src/main/java/io/lettuce/core/models/stream/PendingMessage.java b/src/main/java/io/lettuce/core/models/stream/PendingMessage.java index c7d7c61f2d..b50c152b67 100644 --- a/src/main/java/io/lettuce/core/models/stream/PendingMessage.java +++ b/src/main/java/io/lettuce/core/models/stream/PendingMessage.java @@ -84,4 +84,5 @@ public String toString() { sb.append(']'); return sb.toString(); } + } diff --git a/src/main/java/io/lettuce/core/models/stream/PendingMessages.java b/src/main/java/io/lettuce/core/models/stream/PendingMessages.java index 88d1c6140a..71ecf3f80d 100644 --- a/src/main/java/io/lettuce/core/models/stream/PendingMessages.java +++ b/src/main/java/io/lettuce/core/models/stream/PendingMessages.java @@ -72,4 +72,5 @@ public String toString() { sb.append(']'); return sb.toString(); } + } diff --git a/src/main/java/io/lettuce/core/output/DoubleListOutput.java b/src/main/java/io/lettuce/core/output/DoubleListOutput.java index 24865c2be6..de1c5dfd6f 100644 --- a/src/main/java/io/lettuce/core/output/DoubleListOutput.java +++ b/src/main/java/io/lettuce/core/output/DoubleListOutput.java @@ -48,6 +48,7 @@ public DoubleListOutput(RedisCodec codec) { public void set(ByteBuffer bytes) { output.add(bytes != null ? parseDouble(decodeAscii(bytes)) : null); } + @Override public void set(double number) { output.add(number); diff --git a/src/main/java/io/lettuce/core/output/GenericMapOutput.java b/src/main/java/io/lettuce/core/output/GenericMapOutput.java index d4b10b65c9..a7a5494ae5 100644 --- a/src/main/java/io/lettuce/core/output/GenericMapOutput.java +++ b/src/main/java/io/lettuce/core/output/GenericMapOutput.java @@ -18,6 +18,7 @@ public class GenericMapOutput extends CommandOutput> { boolean hasKey; + private K key; public GenericMapOutput(RedisCodec codec) { diff --git a/src/main/java/io/lettuce/core/output/ListOfGenericMapsOutput.java b/src/main/java/io/lettuce/core/output/ListOfGenericMapsOutput.java index e44166a136..94fc9263c0 100644 --- a/src/main/java/io/lettuce/core/output/ListOfGenericMapsOutput.java +++ b/src/main/java/io/lettuce/core/output/ListOfGenericMapsOutput.java @@ -89,4 +89,5 @@ public void set(long integer) { public void set(double number) { nested.set(number); } + } diff --git a/src/main/java/io/lettuce/core/output/ListOfMapsOutput.java b/src/main/java/io/lettuce/core/output/ListOfMapsOutput.java index 264b7d471c..58621f35d3 100644 --- a/src/main/java/io/lettuce/core/output/ListOfMapsOutput.java +++ b/src/main/java/io/lettuce/core/output/ListOfMapsOutput.java @@ -84,4 +84,5 @@ public void multi(int count) { public void set(long integer) { nested.set(integer); } + } diff --git a/src/main/java/io/lettuce/core/protocol/CommandWrapper.java b/src/main/java/io/lettuce/core/protocol/CommandWrapper.java index f0be8ea54c..3a411cc78d 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandWrapper.java +++ b/src/main/java/io/lettuce/core/protocol/CommandWrapper.java @@ -268,9 +268,8 @@ public static RedisCommand unwrap(RedisCommand wrapp * * If the receiver implements the interface then the result is the receiver or a proxy for the receiver. If the receiver is * a wrapper and the wrapped object implements the interface then the result is the wrapped object or a proxy for the - * wrapped object. Otherwise return the result of calling unwrap recursively on the wrapped object or a - * proxy for that result. If the receiver is not a wrapper and does not implement the interface, then an {@code null} is - * returned. + * wrapped object. Otherwise return the result of calling unwrap recursively on the wrapped object or a proxy + * for that result. If the receiver is not a wrapper and does not implement the interface, then an {@code null} is returned. * * @param wrapped * @param iface A Class defining an interface that the result must implement. diff --git a/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java b/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java index b403f04e3d..84bcb41f1f 100644 --- a/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java +++ b/src/main/java/io/lettuce/core/protocol/ConnectionWatchdog.java @@ -101,7 +101,6 @@ public class ConnectionWatchdog extends ChannelInboundHandlerAdapter { private volatile Timeout reconnectScheduleTimeout; - /** * Create a new watchdog that adds to new connections to the supplied {@link ChannelGroup} and establishes a new * {@link Channel} when disconnected, while reconnect is true. The socketAddressSupplier can supply the reconnect address. diff --git a/src/main/java/io/lettuce/core/protocol/DemandAware.java b/src/main/java/io/lettuce/core/protocol/DemandAware.java index e5e018da93..7ea2c7d6c4 100644 --- a/src/main/java/io/lettuce/core/protocol/DemandAware.java +++ b/src/main/java/io/lettuce/core/protocol/DemandAware.java @@ -20,9 +20,8 @@ public interface DemandAware { interface Sink { /** - * Returns {@code true} if the {@link Sink} has demand or {@code false} if the source has no demand. - * {@code false} means either the {@link Sink} has no demand in general because data is not needed or the current - * demand is saturated. + * Returns {@code true} if the {@link Sink} has demand or {@code false} if the source has no demand. {@code false} means + * either the {@link Sink} has no demand in general because data is not needed or the current demand is saturated. * * @return {@code true} if the {@link Sink} demands data. */ diff --git a/src/main/java/io/lettuce/core/protocol/Endpoint.java b/src/main/java/io/lettuce/core/protocol/Endpoint.java index 797bf324d3..aa55ac43b7 100644 --- a/src/main/java/io/lettuce/core/protocol/Endpoint.java +++ b/src/main/java/io/lettuce/core/protocol/Endpoint.java @@ -57,4 +57,5 @@ public interface Endpoint extends PushHandler { * @since 6.1 */ String getId(); + } diff --git a/src/main/java/io/lettuce/core/protocol/RedisStateMachine.java b/src/main/java/io/lettuce/core/protocol/RedisStateMachine.java index e9ecc34703..bfba5f192b 100644 --- a/src/main/java/io/lettuce/core/protocol/RedisStateMachine.java +++ b/src/main/java/io/lettuce/core/protocol/RedisStateMachine.java @@ -243,11 +243,12 @@ void reset() { */ private static State[] createStates(int len) { final State[] stack = new State[len]; - for (int i = 0;i < len; ++i) { + for (int i = 0; i < len; ++i) { stack[i] = new State(); } return stack; } + } private final State[] stack = State.createStates(32); diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java index 8c486770ec..3da52d877f 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java @@ -102,7 +102,7 @@ Command spublish(K shardChannel, V message) { CommandArgs args = new CommandArgs<>(codec).addKey(shardChannel).addValue(message); return createCommand(SPUBLISH, new IntegerOutput<>(codec), args); } - + @SafeVarargs final Command ssubscribe(K... shardChannels) { LettuceAssert.notEmpty(shardChannels, "Shard channels " + MUST_NOT_BE_EMPTY); @@ -110,7 +110,7 @@ final Command ssubscribe(K... shardChannels) { CommandArgs args = new CommandArgs<>(codec).addKeys(shardChannels); return createCommand(SSUBSCRIBE, new PubSubOutput<>(codec), args); } - + @SafeVarargs final Command subscribe(K... channels) { LettuceAssert.notEmpty(channels, "Channels " + MUST_NOT_BE_EMPTY); diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java index 828a85743f..8b061bacf0 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java @@ -60,7 +60,7 @@ public void punsubscribed(K pattern, long count) { } @Override - public void smessage(K shardChannel, V message) { + public void smessage(K shardChannel, V message) { // empty adapter method } diff --git a/src/main/java/io/lettuce/core/resource/DefaultClientResources.java b/src/main/java/io/lettuce/core/resource/DefaultClientResources.java index 9b20bf21ce..1922bfef66 100644 --- a/src/main/java/io/lettuce/core/resource/DefaultClientResources.java +++ b/src/main/java/io/lettuce/core/resource/DefaultClientResources.java @@ -694,8 +694,8 @@ public DefaultClientResources.Builder mutate() { .commandLatencyPublisherOptions(commandLatencyPublisherOptions()).dnsResolver(dnsResolver()) .eventBus(eventBus()).eventExecutorGroup(eventExecutorGroup()).reconnectDelay(reconnectDelay) .socketAddressResolver(socketAddressResolver()).nettyCustomizer(nettyCustomizer()) - .threadFactoryProvider(threadFactoryProvider).timer(timer()) - .tracing(tracing()).addressResolverGroup(addressResolverGroup()); + .threadFactoryProvider(threadFactoryProvider).timer(timer()).tracing(tracing()) + .addressResolverGroup(addressResolverGroup()); builder.sharedCommandLatencyCollector = sharedEventLoopGroupProvider; builder.sharedEventExecutor = sharedEventExecutor; diff --git a/src/main/java/io/lettuce/core/resource/KqueueProvider.java b/src/main/java/io/lettuce/core/resource/KqueueProvider.java index 5db028f46c..969e090d93 100644 --- a/src/main/java/io/lettuce/core/resource/KqueueProvider.java +++ b/src/main/java/io/lettuce/core/resource/KqueueProvider.java @@ -164,12 +164,10 @@ public SocketAddress newSocketAddress(String socketPath) { @Override public Class datagramChannelClass() { - checkForKqueueLibrary(); return null; } - } /** @@ -219,7 +217,6 @@ public Class datagramChannelClass() { return KQueueDatagramChannel.class; } - @Override public Class domainSocketChannelClass() { @@ -228,7 +225,6 @@ public Class domainSocketChannelClass() { return KQueueDomainSocketChannel.class; } - @Override public SocketAddress newSocketAddress(String socketPath) { diff --git a/src/main/java/io/lettuce/core/resource/MappingSocketAddressResolver.java b/src/main/java/io/lettuce/core/resource/MappingSocketAddressResolver.java index aafc21d7b5..f547b68f94 100644 --- a/src/main/java/io/lettuce/core/resource/MappingSocketAddressResolver.java +++ b/src/main/java/io/lettuce/core/resource/MappingSocketAddressResolver.java @@ -55,8 +55,7 @@ private MappingSocketAddressResolver(DnsResolver dnsResolver, Function mappingFunction) { + public static MappingSocketAddressResolver create(Function mappingFunction) { return new MappingSocketAddressResolver(mappingFunction); } diff --git a/src/main/java/io/lettuce/core/sentinel/RedisSentinelReactiveCommandsImpl.java b/src/main/java/io/lettuce/core/sentinel/RedisSentinelReactiveCommandsImpl.java index f4ec35bf2e..d68142cefa 100644 --- a/src/main/java/io/lettuce/core/sentinel/RedisSentinelReactiveCommandsImpl.java +++ b/src/main/java/io/lettuce/core/sentinel/RedisSentinelReactiveCommandsImpl.java @@ -165,7 +165,7 @@ public Mono info(String section) { return createMono(() -> commandBuilder.info(section)); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Flux dispatch(ProtocolKeyword type, CommandOutput output) { @@ -175,7 +175,7 @@ public Flux dispatch(ProtocolKeyword type, CommandOutput output) return (Flux) createFlux(() -> new Command<>(type, output)); } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public Flux dispatch(ProtocolKeyword type, CommandOutput output, CommandArgs args) { diff --git a/src/main/java/io/lettuce/core/sentinel/api/sync/RedisSentinelCommands.java b/src/main/java/io/lettuce/core/sentinel/api/sync/RedisSentinelCommands.java index 44ef4643d4..b7089c80ee 100644 --- a/src/main/java/io/lettuce/core/sentinel/api/sync/RedisSentinelCommands.java +++ b/src/main/java/io/lettuce/core/sentinel/api/sync/RedisSentinelCommands.java @@ -197,7 +197,8 @@ public interface RedisSentinelCommands { /** * Get the list of the current client connection. * - * @return String bulk-string-reply a unique string, formatted as a succession of property=value fields separated by a space character. + * @return String bulk-string-reply a unique string, formatted as a succession of property=value fields separated by a space + * character. * @since 6.3 */ String clientInfo(); @@ -256,4 +257,5 @@ public interface RedisSentinelCommands { * @return the underlying connection. */ StatefulRedisSentinelConnection getStatefulConnection(); + } diff --git a/src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java b/src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java index 58064b0384..0dd31d7abb 100644 --- a/src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java +++ b/src/main/java/io/lettuce/core/support/AsyncConnectionPoolSupport.java @@ -220,6 +220,7 @@ public CompletableFuture destroy(T object) { public CompletableFuture validate(T object) { return CompletableFuture.completedFuture(object.isOpen()); } + } private static class AsyncPoolWrapper implements Origin { diff --git a/src/main/java/io/lettuce/core/support/BasePoolConfig.java b/src/main/java/io/lettuce/core/support/BasePoolConfig.java index f74ff8effb..e6fb9a6629 100644 --- a/src/main/java/io/lettuce/core/support/BasePoolConfig.java +++ b/src/main/java/io/lettuce/core/support/BasePoolConfig.java @@ -94,8 +94,8 @@ public Builder testOnCreate() { * Validation is performed by the {@link AsyncObjectFactory#validate(Object)} method of the factory associated with the * pool. If the object fails to validate, then acquire will fail. * - * @param testOnCreate {@code true} if newly created objects should be validated before being returned from the - * acquire method. {@code true} to enable test on creation. + * @param testOnCreate {@code true} if newly created objects should be validated before being returned from the acquire + * method. {@code true} to enable test on creation. * * @return {@code this} {@link Builder}. */ diff --git a/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java b/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java index 489626f397..a882be567f 100644 --- a/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java +++ b/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java @@ -85,8 +85,8 @@ private ConnectionPoolSupport() { * @param connectionSupplier must not be {@code null}. * @param config must not be {@code null}. * @param wrapConnections {@code false} to return direct connections that need to be returned to the pool using - * {@link ObjectPool#returnObject(Object)}. {@code true} to return wrapped connection that are returned to the - * pool when invoking {@link StatefulConnection#close()}. + * {@link ObjectPool#returnObject(Object)}. {@code true} to return wrapped connection that are returned to the pool + * when invoking {@link StatefulConnection#close()}. * @param connection type. * @return the connection pool. */ @@ -142,8 +142,8 @@ public void returnObject(T obj) { * * @param connectionSupplier must not be {@code null}. * @param wrapConnections {@code false} to return direct connections that need to be returned to the pool using - * {@link ObjectPool#returnObject(Object)}. {@code true} to return wrapped connection that are returned to the - * pool when invoking {@link StatefulConnection#close()}. + * {@link ObjectPool#returnObject(Object)}. {@code true} to return wrapped connection that are returned to the pool + * when invoking {@link StatefulConnection#close()}. * @param connection type. * @return the connection pool. */ diff --git a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java index 27c5723f0f..3fa6f26e4a 100644 --- a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java +++ b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java @@ -190,8 +190,8 @@ public interface BaseRedisCommands { /** * @return {@code true} if the connection is open (connected and not closed). - * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the connection - * interface. To be removed with Lettuce 7.0. + * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#isOpen()} method on the + * connection interface. To be removed with Lettuce 7.0. */ @Deprecated boolean isOpen(); @@ -199,8 +199,9 @@ public interface BaseRedisCommands { /** * Reset the command state. Queued commands will be canceled and the internal state will be reset. This is useful when the * internal state machine gets out of sync with the connection. - * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#reset()} method on the connection - * interface. To be removed with Lettuce 7.0. + * + * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#reset()} method on the + * connection interface. To be removed with Lettuce 7.0. */ @Deprecated void reset(); @@ -211,9 +212,9 @@ public interface BaseRedisCommands { * issued. After calling {@link #flushCommands()} commands are sent to the transport and executed by Redis. * * @param autoFlush state of autoFlush. - * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)} method on the connection - * interface. To be removed with Lettuce 7.0. - + * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#setAutoFlushCommands(boolean)} + * method on the connection interface. To be removed with Lettuce 7.0. + * */ @Deprecated void setAutoFlushCommands(boolean autoFlush); @@ -221,9 +222,10 @@ public interface BaseRedisCommands { /** * Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to * achieve batching. No-op if channel is not connected. - * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#flushCommands()} method on the connection - * interface. To be removed with Lettuce 7.0. - + * + * @deprecated since 6.2. Use the corresponding {@link io.lettuce.core.api.StatefulConnection#flushCommands()} method on the + * connection interface. To be removed with Lettuce 7.0. + * */ @Deprecated void flushCommands(); diff --git a/src/main/templates/io/lettuce/core/api/RedisAclCommands.java b/src/main/templates/io/lettuce/core/api/RedisAclCommands.java index 6a3b0e58f6..c4dd88c499 100644 --- a/src/main/templates/io/lettuce/core/api/RedisAclCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisAclCommands.java @@ -110,8 +110,8 @@ public interface RedisAclCommands { List aclList(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), this command - * will reload the ACLs from the file, replacing all the current ACL rules with the ones defined in the file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will reload the ACLs + * from the file, replacing all the current ACL rules with the ones defined in the file. * * @return String simple-string-reply OK or error message. */ @@ -140,8 +140,8 @@ public interface RedisAclCommands { String aclLogReset(); /** - * When Redis is configured to use an ACL file (with the aclfile configuration option), - * this command will save the currently defined ACLs from the server memory to the ACL file. + * When Redis is configured to use an ACL file (with the aclfile configuration option), this command will save the currently + * defined ACLs from the server memory to the ACL file. * * @return String simple-string-reply OK or error message. */ @@ -169,4 +169,5 @@ public interface RedisAclCommands { * @return K bulk-string-reply the username of the current connection. */ String aclWhoami(); + } diff --git a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java index 7a9a8663e2..3bab7c2b01 100644 --- a/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisGeoCommands.java @@ -191,8 +191,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg Long georadiusbymember(K key, V member, double distance, GeoArgs.Unit unit, GeoRadiusStoreArgs geoRadiusStoreArgs); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -203,8 +203,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg Set geosearch(K key, GeoSearch.GeoRef reference, GeoSearch.GeoPredicate predicate); /** - * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. - * Use {@link GeoSearch} to create reference and predicate objects. + * Retrieve members selected by distance with the center of {@code reference} the search {@code predicate}. Use + * {@link GeoSearch} to create reference and predicate objects. * * @param key the key of the geo set. * @param reference the reference member or longitude/latitude coordinates. @@ -224,7 +224,8 @@ Long georadius(K key, double longitude, double latitude, double distance, GeoArg * @param reference the reference member or longitude/latitude coordinates. * @param predicate the bounding box or radius to search in. * @param geoArgs args to control the result. - * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape. + * @param storeDist stores the items in a sorted set populated with their distance from the center of the circle or box, as + * a floating-point number, in the same unit specified for that shape. * @return Long integer-reply the number of elements in the result. * @since 6.1 */ diff --git a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java index 96dfe525eb..53896d05a7 100644 --- a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java @@ -575,4 +575,5 @@ public interface RedisHashCommands { * associated timeout. */ Boolean hpersist(K key, K... fields); + } diff --git a/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java b/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java index 841e14a835..1c7f4fca79 100644 --- a/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisSortedSetCommands.java @@ -488,7 +488,8 @@ public interface RedisSortedSetCommands { * Return {@code count} random members from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -507,7 +508,8 @@ public interface RedisSortedSetCommands { * Return {@code count} random members along their value from the sorted set stored at {@code key}. * * @param key the key. - * @param count the number of members to return. If the provided count argument is positive, return an array of distinct fields. + * @param count the number of members to return. If the provided count argument is positive, return an array of distinct + * fields. * @return List<ScoredValue<V>> array-reply list of scores and elements. * @since 6.1 */ @@ -909,7 +911,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -920,7 +923,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri Long zrangestore(K dstKey, K srcKey, Range range); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -932,7 +936,8 @@ Long zrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Stri Long zrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey} and stores the result in the + * {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1409,7 +1414,8 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, Range range, Limit limit); /** - * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements ordered from high to low in the sorted set stored at {@code srcKey} and stores the + * result in the {@code dstKey} destination key. * * @param dstKey the dst key. * @param srcKey the src key. @@ -1420,7 +1426,8 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S Long zrevrangestore(K dstKey, K srcKey, Range range); /** - * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores the result in the {@code dstKey} destination key. + * Get the lexicographical range ordered from high to low of elements in the sorted set stored at {@code srcKey} and stores + * the result in the {@code dstKey} destination key. * * @param dstKey the src key. * @param srcKey the dst key. @@ -1432,9 +1439,11 @@ Long zrevrangebyscoreWithScores(ScoredValueStreamingChannel channel, K key, S Long zrevrangestorebylex(K dstKey, K srcKey, Range range, Limit limit); /** - * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and stores the result in the {@code dstKey} destination key. + * Get the specified range of elements in the sorted set stored at {@code srcKey with scores ordered from high to low and + * stores the result in the {@code dstKey} destination key. * * @param dstKey the src key. + * * @param srcKey the dst key. * @param range the score range. * @param limit the limit to apply. diff --git a/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java b/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java index 29c39e379a..232f1f618c 100644 --- a/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisStreamCommands.java @@ -373,4 +373,5 @@ public interface RedisStreamCommands { * @since 6.1 */ Long xtrim(K key, XTrimArgs args); + } diff --git a/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java b/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java index 57bf25031c..ab9432db10 100644 --- a/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java +++ b/src/test/java/biz/paluch/redis/extensibility/LettuceGeoDemo.java @@ -47,4 +47,5 @@ public static void main(String[] args) { redis.getStatefulConnection().close(); redisClient.shutdown(); } + } diff --git a/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java b/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java index c52c768140..99b029a588 100644 --- a/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java +++ b/src/test/java/biz/paluch/redis/extensibility/MyExtendedRedisClient.java @@ -32,4 +32,5 @@ protected StatefulRedisPubSubConnectionImpl newStatefulRedisPubSubC RedisChannelWriter channelWriter, RedisCodec codec, Duration timeout) { return new MyPubSubConnection<>(endpoint, channelWriter, codec, timeout); } + } diff --git a/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java b/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java index 6e91f06a70..7fd38c7750 100644 --- a/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java +++ b/src/test/java/biz/paluch/redis/extensibility/MyPubSubConnection.java @@ -28,7 +28,8 @@ class MyPubSubConnection extends StatefulRedisPubSubConnectionImpl { * @param codec Codec used to encode/decode keys and values. * @param timeout Maximum time to wait for a response. */ - public MyPubSubConnection(PubSubEndpoint endpoint, RedisChannelWriter writer, RedisCodec codec, Duration timeout) { + public MyPubSubConnection(PubSubEndpoint endpoint, RedisChannelWriter writer, RedisCodec codec, + Duration timeout) { super(endpoint, writer, codec, timeout); } @@ -41,4 +42,5 @@ public RedisCommand dispatch(RedisCommand command) { return super.dispatch(command); } + } diff --git a/src/test/java/io/lettuce/RedisBug.java b/src/test/java/io/lettuce/RedisBug.java index 429cf77353..12078cfd86 100644 --- a/src/test/java/io/lettuce/RedisBug.java +++ b/src/test/java/io/lettuce/RedisBug.java @@ -14,5 +14,7 @@ @Documented @Disabled("Redis Bug") public @interface RedisBug { + String value() default ""; + } diff --git a/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java b/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java index 2be57d325b..55e54d0496 100644 --- a/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java +++ b/src/test/java/io/lettuce/apigenerator/CompilationUnitFactory.java @@ -90,22 +90,24 @@ class CompilationUnitFactory { private CompilationUnit template; private final CompilationUnit result = new CompilationUnit(); + private ClassOrInterfaceDeclaration resultType; public CompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName, - Function typeDocFunction, Function methodReturnTypeFunction, - Predicate methodFilter, Supplier> importSupplier, - Consumer typeMutator, Function methodCommentMutator) { + Function typeDocFunction, Function methodReturnTypeFunction, + Predicate methodFilter, Supplier> importSupplier, + Consumer typeMutator, Function methodCommentMutator) { this(templateFile, sources, targetPackage, targetName, typeDocFunction, methodReturnTypeFunction, methodDeclaration -> { - }, methodFilter, importSupplier, typeMutator, (m, c) -> methodCommentMutator != null ? methodCommentMutator.apply(c) : c); + }, methodFilter, importSupplier, typeMutator, + (m, c) -> methodCommentMutator != null ? methodCommentMutator.apply(c) : c); } public CompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName, - Function typeDocFunction, Function methodReturnTypeFunction, - Consumer onMethod, Predicate methodFilter, - Supplier> importSupplier, Consumer typeMutator, - BiFunction methodCommentMutator) { + Function typeDocFunction, Function methodReturnTypeFunction, + Consumer onMethod, Predicate methodFilter, + Supplier> importSupplier, Consumer typeMutator, + BiFunction methodCommentMutator) { this.templateFile = templateFile; this.sources = sources; @@ -139,11 +141,13 @@ public void createInterface() throws Exception { if (!templateTypeDeclaration.getTypeParameters().isEmpty()) { resultType.setTypeParameters(new NodeList<>()); for (TypeParameter typeParameter : templateTypeDeclaration.getTypeParameters()) { - resultType.getTypeParameters().add(new TypeParameter(typeParameter.getName().getIdentifier(), typeParameter.getTypeBound())); + resultType.getTypeParameters() + .add(new TypeParameter(typeParameter.getName().getIdentifier(), typeParameter.getTypeBound())); } } - resultType.setComment(new JavadocComment(typeDocFunction.apply(templateTypeDeclaration.getComment().get().getContent()))); + resultType + .setComment(new JavadocComment(typeDocFunction.apply(templateTypeDeclaration.getComment().get().getContent()))); result.setComment(template.getComment().orElse(null)); result.setImports(new NodeList<>()); @@ -209,24 +213,19 @@ public static boolean contains(Collection haystack, MethodDeclaration ne public void removeUnusedImports() { ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) result.getChildNodes().get(1); - List optimizedImports = result - .getImports() - .stream() - .filter(i -> i.isAsterisk() - || i.isStatic() - || declaringClass.findFirst(Type.class, t -> { - String fullType = t.toString(); - String importIdentifier = i.getName().getIdentifier(); - - return fullType.contains(importIdentifier); - }).isPresent() - ) - .sorted((o1, o2) -> { - if (o1.getNameAsString().startsWith("java")) return -1; - if (o2.getNameAsString().startsWith("java")) return 1; + List optimizedImports = result.getImports().stream() + .filter(i -> i.isAsterisk() || i.isStatic() || declaringClass.findFirst(Type.class, t -> { + String fullType = t.toString(); + String importIdentifier = i.getName().getIdentifier(); + + return fullType.contains(importIdentifier); + }).isPresent()).sorted((o1, o2) -> { + if (o1.getNameAsString().startsWith("java")) + return -1; + if (o2.getNameAsString().startsWith("java")) + return 1; return o1.getNameAsString().compareTo(o2.getNameAsString()); - }) - .collect(Collectors.toList()); + }).collect(Collectors.toList()); result.setImports(NodeList.nodeList(optimizedImports)); } @@ -263,16 +262,15 @@ public void visit(MethodDeclaration parsedDeclaration, Object arg) { private Type getMethodReturnType(MethodDeclaration parsedDeclaration) { - List, Function>> entries = new ArrayList<>(methodReturnTypeMutation.entrySet()); + List, Function>> entries = new ArrayList<>( + methodReturnTypeMutation.entrySet()); Collections.reverse(entries); - return entries - .stream() - .filter(entry -> entry.getKey().test(parsedDeclaration)) - .findFirst() - .map(entry -> entry.getValue().apply(parsedDeclaration)) - .orElse(null); + return entries.stream().filter(entry -> entry.getKey().test(parsedDeclaration)).findFirst() + .map(entry -> entry.getValue().apply(parsedDeclaration)).orElse(null); } + } + } diff --git a/src/test/java/io/lettuce/apigenerator/Constants.java b/src/test/java/io/lettuce/apigenerator/Constants.java index 744fccbf16..2779ed17aa 100644 --- a/src/test/java/io/lettuce/apigenerator/Constants.java +++ b/src/test/java/io/lettuce/apigenerator/Constants.java @@ -26,26 +26,15 @@ */ class Constants { - public static final String[] TEMPLATE_NAMES = { - "BaseRedisCommands", - "RedisAclCommands", - "RedisFunctionCommands", - "RedisGeoCommands", - "RedisHashCommands", - "RedisHLLCommands", - "RedisKeyCommands", - "RedisListCommands", - "RedisScriptingCommands", - "RedisSentinelCommands", - "RedisServerCommands", - "RedisSetCommands", - "RedisSortedSetCommands", - "RedisStreamCommands", - "RedisStringCommands", - "RedisTransactionalCommands" - }; + public static final String[] TEMPLATE_NAMES = { "BaseRedisCommands", "RedisAclCommands", "RedisFunctionCommands", + "RedisGeoCommands", "RedisHashCommands", "RedisHLLCommands", "RedisKeyCommands", "RedisListCommands", + "RedisScriptingCommands", "RedisSentinelCommands", "RedisServerCommands", "RedisSetCommands", + "RedisSortedSetCommands", "RedisStreamCommands", "RedisStringCommands", "RedisTransactionalCommands" }; public static final File TEMPLATES = new File("src/main/templates"); + public static final File SOURCES = new File("src/main/java"); + public static final File KOTLIN_SOURCES = new File("src/main/kotlin"); + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java b/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java index 300ce31c57..8006578bd7 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateAsyncApi.java @@ -42,7 +42,9 @@ */ class CreateAsyncApi { - public static final Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands"); + public static final Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("shutdown", "debugOom", + "debugSegfault", "digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection", + "setAutoFlushCommands", "flushCommands"); /** * Mutate type comment. @@ -101,4 +103,5 @@ private CompilationUnitFactory createFactory(String templateName) { return factory; } + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java b/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java index 294d117c93..7fc1a4f516 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateAsyncNodeSelectionClusterApi.java @@ -45,9 +45,12 @@ */ class CreateAsyncNodeSelectionClusterApi { - private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", "RedisTransactionalCommands"); - private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest", "close", - "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "setAutoFlushCommands", "flushCommands"); + private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", + "RedisTransactionalCommands"); + + private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", + "digest", "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "setAutoFlushCommands", + "flushCommands"); /** * Mutate type comment. @@ -93,10 +96,7 @@ void createInterface(String argument) throws Exception { } static List arguments() { - return Stream - .of(Constants.TEMPLATE_NAMES) - .filter(t -> !FILTER_TEMPLATES.contains(t)) - .collect(Collectors.toList()); + return Stream.of(Constants.TEMPLATE_NAMES).filter(t -> !FILTER_TEMPLATES.contains(t)).collect(Collectors.toList()); } private CompilationUnitFactory createFactory(String templateName) { @@ -110,4 +110,5 @@ private CompilationUnitFactory createFactory(String templateName) { return factory; } + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java b/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java index 4069bf8da2..ce38436e25 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateKotlinCoroutinesApi.java @@ -44,10 +44,7 @@ public class CreateKotlinCoroutinesApi { * @return */ Supplier> importSupplier() { - return () -> Arrays.asList( - "io.lettuce.core.ExperimentalLettuceCoroutinesApi", - "kotlinx.coroutines.flow.Flow" - ); + return () -> Arrays.asList("io.lettuce.core.ExperimentalLettuceCoroutinesApi", "kotlinx.coroutines.flow.Flow"); } /** @@ -56,11 +53,8 @@ Supplier> importSupplier() { * @return */ Function commentInjector() { - return s -> s - .replaceAll("\\$\\{intent}", "Coroutine executed commands") - .replaceAll("\\$\\{author}", "Mikhael Sokolov") - .replaceAll("\\$\\{since}", "6.0") - .replaceAll("\\$\\{generator}", getClass().getName()); + return s -> s.replaceAll("\\$\\{intent}", "Coroutine executed commands").replaceAll("\\$\\{author}", "Mikhael Sokolov") + .replaceAll("\\$\\{since}", "6.0").replaceAll("\\$\\{generator}", getClass().getName()); } @ParameterizedTest @@ -84,7 +78,8 @@ private KotlinCompilationUnitFactory createFactory(String templateName) { targetPackage = "io.lettuce.core.api.coroutines"; } - return new KotlinCompilationUnitFactory(templateFile, KOTLIN_SOURCES, targetPackage, - targetName, importSupplier(), commentInjector()); + return new KotlinCompilationUnitFactory(templateFile, KOTLIN_SOURCES, targetPackage, targetName, importSupplier(), + commentInjector()); } + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java b/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java index 8444a7c645..d66872e4bc 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateReactiveApi.java @@ -51,10 +51,12 @@ */ public class CreateReactiveApi { - public static Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("digest", "close", "isOpen", "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands"); + public static Set KEEP_METHOD_RESULT_TYPE = LettuceSets.unmodifiableSet("digest", "close", "isOpen", + "BaseRedisCommands.reset", "getStatefulConnection", "setAutoFlushCommands", "flushCommands"); public static Set FORCE_FLUX_RESULT = LettuceSets.unmodifiableSet("eval", "evalsha", "evalReadOnly", "evalshaReadOnly", "fcall", "fcallReadOnly", "dispatch"); + public static Set VALUE_WRAP = LettuceSets.unmodifiableSet("geopos", "bitfield"); private static final Map RESULT_SPEC; @@ -160,8 +162,7 @@ Function methodTypeMutator() { }; } - private String getResultType(MethodDeclaration method, - ClassOrInterfaceDeclaration classOfMethod) { + private String getResultType(MethodDeclaration method, ClassOrInterfaceDeclaration classOfMethod) { String declaration = nameAndParameters(method); if (RESULT_SPEC.containsKey(declaration)) { @@ -211,8 +212,8 @@ private CompilationUnitFactory createFactory(String templateName) { targetPackage = "io.lettuce.core.api.reactive"; } - CompilationUnitFactory factory = new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName, commentMutator(), - methodTypeMutator(), methodMutator(), methodDeclaration -> true, importSupplier(), null, + CompilationUnitFactory factory = new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName, + commentMutator(), methodTypeMutator(), methodMutator(), methodDeclaration -> true, importSupplier(), null, methodCommentMutator()); factory.keepMethodSignaturesFor(KEEP_METHOD_RESULT_TYPE); return factory; @@ -234,4 +235,5 @@ static String nameAndParameters(MethodDeclaration method) { sb.append(")"); return sb.toString(); } + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java b/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java index fb9bf9fcc0..697bf5dce7 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateSyncApi.java @@ -51,8 +51,8 @@ class CreateSyncApi { * @return */ Function commentMutator() { - return s -> s.replaceAll("\\$\\{intent\\}", "Synchronous executed commands") + "* @generated by " - + getClass().getName() + "\r\n "; + return s -> s.replaceAll("\\$\\{intent\\}", "Synchronous executed commands") + "* @generated by " + getClass().getName() + + "\r\n "; } /** @@ -106,4 +106,5 @@ private CompilationUnitFactory createFactory(String templateName) { return new CompilationUnitFactory(templateFile, Constants.SOURCES, targetPackage, targetName, commentMutator(), methodTypeMutator(), methodFilter(), importSupplier(), null, Function.identity()); } + } diff --git a/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java b/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java index 88ae384697..9813912cc2 100644 --- a/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java +++ b/src/test/java/io/lettuce/apigenerator/CreateSyncNodeSelectionClusterApi.java @@ -47,9 +47,12 @@ @SuppressWarnings("OptionalGetWithoutIsPresent") public class CreateSyncNodeSelectionClusterApi { - private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", "RedisTransactionalCommands"); - private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", "digest", - "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "dispatch", "setAutoFlushCommands", "flushCommands"); + private static final Set FILTER_TEMPLATES = LettuceSets.unmodifiableSet("RedisSentinelCommands", + "RedisTransactionalCommands"); + + private static final Set FILTER_METHODS = LettuceSets.unmodifiableSet("shutdown", "debugOom", "debugSegfault", + "digest", "close", "isOpen", "BaseRedisCommands.reset", "readOnly", "readWrite", "dispatch", "setAutoFlushCommands", + "flushCommands"); /** * Mutate type comment. @@ -99,10 +102,7 @@ void createInterface(String argument) throws Exception { } static List arguments() { - return Stream - .of(Constants.TEMPLATE_NAMES) - .filter(t -> !FILTER_TEMPLATES.contains(t)) - .collect(Collectors.toList()); + return Stream.of(Constants.TEMPLATE_NAMES).filter(t -> !FILTER_TEMPLATES.contains(t)).collect(Collectors.toList()); } private CompilationUnitFactory createFactory(String templateName) { @@ -116,4 +116,5 @@ private CompilationUnitFactory createFactory(String templateName) { factory.keepMethodSignaturesFor(FILTER_METHODS); return factory; } + } diff --git a/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java b/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java index 341b1d0477..9b160643ee 100644 --- a/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java +++ b/src/test/java/io/lettuce/apigenerator/KotlinCompilationUnitFactory.java @@ -60,26 +60,33 @@ @SuppressWarnings("OptionalGetWithoutIsPresent") class KotlinCompilationUnitFactory { - private static final Set SKIP_IMPORTS = LettuceSets.unmodifiableSet("java.util.List", "java.util.Set", "java.util.Map"); - private static final Set NON_SUSPENDABLE_METHODS = LettuceSets.unmodifiableSet("isOpen", "flushCommands", "setAutoFlushCommands"); - private static final Set SKIP_METHODS = LettuceSets.unmodifiableSet("BaseRedisCommands.reset", "getStatefulConnection"); - - private static final Set FLOW_METHODS = LettuceSets.unmodifiableSet("aclList", "aclLog", "dispatch", "geohash", "georadius", - "georadiusbymember", "geosearch", - "hgetall", "hkeys", "hmget", "hvals", "keys", "mget", "sdiff", "sinter", "smembers", "smismember", "sort", - "sortReadOnly", "srandmember", "sunion", - "xclaim", "xpending", "xrange", "xread", "xreadgroup", "xrevrange", "zdiff", "zdiffWithScores", "zinter", "zinterWithScores", "zpopmax", "zpopmin", "zrange", - "zrangeWithScores", "zrangebylex", "zrangebyscore", "zrangebyscoreWithScores", "zrevrange", "zrevrangeWithScores", "zrevrangebylex", - "zrevrangebyscore", "zrevrangebyscore", "zrevrangebyscoreWithScores", "zunion", "zunionWithScores"); + private static final Set SKIP_IMPORTS = LettuceSets.unmodifiableSet("java.util.List", "java.util.Set", + "java.util.Map"); + + private static final Set NON_SUSPENDABLE_METHODS = LettuceSets.unmodifiableSet("isOpen", "flushCommands", + "setAutoFlushCommands"); + + private static final Set SKIP_METHODS = LettuceSets.unmodifiableSet("BaseRedisCommands.reset", + "getStatefulConnection"); + + private static final Set FLOW_METHODS = LettuceSets.unmodifiableSet("aclList", "aclLog", "dispatch", "geohash", + "georadius", "georadiusbymember", "geosearch", "hgetall", "hkeys", "hmget", "hvals", "keys", "mget", "sdiff", + "sinter", "smembers", "smismember", "sort", "sortReadOnly", "srandmember", "sunion", "xclaim", "xpending", "xrange", + "xread", "xreadgroup", "xrevrange", "zdiff", "zdiffWithScores", "zinter", "zinterWithScores", "zpopmax", "zpopmin", + "zrange", "zrangeWithScores", "zrangebylex", "zrangebyscore", "zrangebyscoreWithScores", "zrevrange", + "zrevrangeWithScores", "zrevrangebylex", "zrevrangebyscore", "zrevrangebyscore", "zrevrangebyscoreWithScores", + "zunion", "zunionWithScores"); private static final Set NON_NULLABLE_RESULT_METHODS = LettuceSets.unmodifiableSet("discard", "multi", "exec", "watch", "unwatch", "getMasterAddrByName", "master", "reset", "failover", "monitor", "RedisSentinelCoroutinesCommands.set", "remove", "RedisSentinelCoroutinesCommands.clientSetname", "RedisSentinelCoroutinesCommands.clientKill", "RedisSentinelCoroutinesCommands.clientPause", "RedisSentinelCoroutinesCommands.clientList", "RedisSentinelCoroutinesCommands.info", - "RedisSentinelCoroutinesCommands.ping", "pubsubNumsub", "pubsubShardNumsub", "pubsubNumpat", "echo", "ping", "readOnly", "readWrite"); + "RedisSentinelCoroutinesCommands.ping", "pubsubNumsub", "pubsubShardNumsub", "pubsubNumpat", "echo", "ping", + "readOnly", "readWrite"); private static final Map RESULT_SPEC; + private static final Map KEEP_DEPRECATED_METHODS; static { @@ -100,21 +107,21 @@ class KotlinCompilationUnitFactory { private static final String FORMATTING_INDENT = " "; private final File templateFile; + private final File target; + private final String targetPackage; + private final String targetName; private final Supplier> importSupplier; + private final Function commentInjector; private final StringBuilder result = new StringBuilder(); - public KotlinCompilationUnitFactory(File templateFile, - File sources, - String targetPackage, - String targetName, - Supplier> importSupplier, - Function commentInjector) { + public KotlinCompilationUnitFactory(File templateFile, File sources, String targetPackage, String targetName, + Supplier> importSupplier, Function commentInjector) { this.templateFile = templateFile; this.targetPackage = targetPackage; this.targetName = targetName; @@ -136,40 +143,23 @@ public void create() throws Exception { importSupplier.get().forEach(l -> result.append("import ").append(l).append("\n")); - template - .getImports() - .stream() - .filter(i -> SKIP_IMPORTS - .stream() - .noneMatch(si -> si.equals(i.getNameAsString())) - ) - .forEach(i -> result - .append("import ") - .append(i.getNameAsString()) - .append(i.isAsterisk() ? ".*" : "") - .append("\n") - ); + template.getImports().stream().filter(i -> SKIP_IMPORTS.stream().noneMatch(si -> si.equals(i.getNameAsString()))) + .forEach(i -> result.append("import ").append(i.getNameAsString()).append(i.isAsterisk() ? ".*" : "") + .append("\n")); result.append("\n"); ClassOrInterfaceDeclaration clazz = (ClassOrInterfaceDeclaration) template.getTypes().get(0); result.append(commentInjector.apply(extractJavadoc(clazz.getJavadoc().get()) - .replaceAll("@author Mark Paluch", "@author \\${author}") - .replaceAll("@since [0-9].0", "@since \\${since}") - .replaceAll("\\*/", "* @generated by \\${generator}\r\n */") - )); + .replaceAll("@author Mark Paluch", "@author \\${author}").replaceAll("@since [0-9].0", "@since \\${since}") + .replaceAll("\\*/", "* @generated by \\${generator}\r\n */"))); result.append("@ExperimentalLettuceCoroutinesApi").append("\n"); NodeList typeParameters = clazz.getTypeParameters(); - result - .append("interface ") - .append(targetName) - .append(extractTypeParams(typeParameters, "Any")) - .append(" "); - + result.append("interface ").append(targetName).append(extractTypeParams(typeParameters, "Any")).append(" "); result.append("{\n\n"); new MethodVisitor().visit(template, null); @@ -190,59 +180,51 @@ public void visit(MethodDeclaration method, Object arg) { return; } - result - .append(FORMATTING_INDENT) + result.append(FORMATTING_INDENT) .append(extractJavadoc(method.getJavadoc().get()).replace("\n", "\n" + FORMATTING_INDENT)) .append(extractAnnotations(method)) - .append(contains(NON_SUSPENDABLE_METHODS, method) || isFlowable(method) ? "" : "suspend ") - .append("fun ") - .append(method.getTypeParameters().isNonEmpty() ? extractTypeParams(method.getTypeParameters(), "Any").concat(" ") : "") - .append(method.getNameAsString()) - .append("(") - .append(extractParameters(method)) - .append(")") - .append(customResultType(method).orElse(toKotlinType(method.getType(), isFlowable(method), contains(NON_NULLABLE_RESULT_METHODS, method)))) + .append(contains(NON_SUSPENDABLE_METHODS, method) || isFlowable(method) ? "" : "suspend ").append("fun ") + .append(method.getTypeParameters().isNonEmpty() + ? extractTypeParams(method.getTypeParameters(), "Any").concat(" ") + : "") + .append(method.getNameAsString()).append("(").append(extractParameters(method)).append(")") + .append(customResultType(method).orElse( + toKotlinType(method.getType(), isFlowable(method), contains(NON_NULLABLE_RESULT_METHODS, method)))) .append("\n\n"); } private String extractAnnotations(MethodDeclaration method) { - return method - .getAnnotations() - .stream() - .map(a -> { - String annotation = a.getNameAsString(); - if (annotation.equals("Deprecated")) { - String identifier = method.getName().getIdentifier(); - String replacement = KEEP_DEPRECATED_METHODS.get(identifier); - return "@" + annotation + "(\"Use [" + replacement + "] instead.\", ReplaceWith(\"" + replacement + "\"))\n" + FORMATTING_INDENT; - } else { - return "@" + annotation + "\n" + FORMATTING_INDENT; - } - }) - .collect(joining()); + return method.getAnnotations().stream().map(a -> { + String annotation = a.getNameAsString(); + if (annotation.equals("Deprecated")) { + String identifier = method.getName().getIdentifier(); + String replacement = KEEP_DEPRECATED_METHODS.get(identifier); + return "@" + annotation + "(\"Use [" + replacement + "] instead.\", ReplaceWith(\"" + replacement + "\"))\n" + + FORMATTING_INDENT; + } else { + return "@" + annotation + "\n" + FORMATTING_INDENT; + } + }).collect(joining()); } private String extractParameters(MethodDeclaration method) { - return method - .getParameters() - .stream() + return method.getParameters().stream() .map(p -> (p.isVarArgs() ? "vararg " : "") + p.getName() + toKotlinType(p.getType(), false, true)) .collect(joining(", ")); } private Optional customResultType(MethodDeclaration method) { ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) method.getParentNode().get(); - return RESULT_SPEC - .entrySet() - .stream() - .filter(e -> e.getKey().equals(method.getNameAsString()) || e.getKey().contains(declaringClass.getNameAsString() + "." + method.getNameAsString())) - .findFirst() - .map(e -> ": " + e.getValue()); + return RESULT_SPEC.entrySet().stream() + .filter(e -> e.getKey().equals(method.getNameAsString()) + || e.getKey().contains(declaringClass.getNameAsString() + "." + method.getNameAsString())) + .findFirst().map(e -> ": " + e.getValue()); } private boolean contains(Collection haystack, MethodDeclaration method) { ClassOrInterfaceDeclaration declaringClass = (ClassOrInterfaceDeclaration) method.getParentNode().get(); - return haystack.contains(method.getNameAsString()) || haystack.contains(declaringClass.getNameAsString() + "." + method.getNameAsString()); + return haystack.contains(method.getNameAsString()) + || haystack.contains(declaringClass.getNameAsString() + "." + method.getNameAsString()); } private boolean isCollection(Type type) { @@ -266,54 +248,34 @@ private String toKotlinType(Type type, boolean isFlowable, boolean isForceNonNul fixedType = String.format("Array<%s>", componentType.asString()); } } else if (type.isPrimitiveType()) { - fixedType = type - .asPrimitiveType() - .toBoxedType() - .getName() - .asString() - .replace("Integer", "Int") + fixedType = type.asPrimitiveType().toBoxedType().getName().asString().replace("Integer", "Int") .replace("Object", "Any"); } else if (isFlowable) { - fixedType = type - .asString() - .replaceFirst("List|Map|Set", "Flow") - .replace("T", "Flow") - .replace("Object", "Any") - .replace(",", ", "); + fixedType = type.asString().replaceFirst("List|Map|Set", "Flow").replace("T", "Flow") + .replace("Object", "Any").replace(",", ", "); } else { - fixedType = type - .asString() - .replace("void", "Unit") - .replace("Object", "Any") - .replace("? extends", "out") - .replace("? super", "in") - .replace(",", ", "); + fixedType = type.asString().replace("void", "Unit").replace("Object", "Any").replace("? extends", "out") + .replace("? super", "in").replace(",", ", "); } boolean nullable = !isForceNonNullable && !isFlowable && !type.isPrimitiveType() && !isCollection(type); return fixedType.equals("Unit") ? "" : ": " + (nullable ? fixedType + "?" : fixedType); } + } public static String extractTypeParams(NodeList typeParams, String bounds) { if (typeParams.isEmpty()) { return ""; } else { - return typeParams - .stream() - .map(tp -> tp.getName().getIdentifier() + (bounds != null ? " : " + bounds : "")) + return typeParams.stream().map(tp -> tp.getName().getIdentifier() + (bounds != null ? " : " + bounds : "")) .collect(joining(", ", "<", ">")); } } public static String extractJavadoc(Javadoc javadoc) { - String plainJavadoc = javadoc - .toComment() - .getContent() - .replace("<", "<") - .replace(">", ">") - .replace("* \n", "*\n"); + String plainJavadoc = javadoc.toComment().getContent().replace("<", "<").replace(">", ">").replace("* \n", "*\n"); return String.format("/**%s*/\n", convertToKotlinDoc(plainJavadoc)); } @@ -332,26 +294,25 @@ public static String convertToKotlinDoc(String javaDoc) { res = replaceSurrounding(res, "{@code ", "}", "`", "`"); res = replaceSurrounding(res, "{@link ", "}", "[", "]"); - return res - .replace("java.lang.Object", "Any") - .replace("Object", "Any") - .replaceAll("\\bdouble\\b", "Double") + return res.replace("java.lang.Object", "Any").replace("Object", "Any").replaceAll("\\bdouble\\b", "Double") .replaceAll("\\bint\\b", "Integer"); } - public static String replaceSurrounding(String original, String prefix, String suffix, String replacePrefix, String replaceSuffix) { - Matcher matcher = Pattern.compile(Pattern.quote(prefix) + "[a-zA-Z0-9.,#\\-~()*\\s]+" + Pattern.quote(suffix)).matcher(original); + public static String replaceSurrounding(String original, String prefix, String suffix, String replacePrefix, + String replaceSuffix) { + Matcher matcher = Pattern.compile(Pattern.quote(prefix) + "[a-zA-Z0-9.,#\\-~()*\\s]+" + Pattern.quote(suffix)) + .matcher(original); StringBuffer result = new StringBuffer(); while (matcher.find()) { String substr = StringUtils.substringBetween(matcher.group(), prefix, suffix); - String replacement = (replacePrefix + substr + replaceSuffix) - .replace("()", "") - .replace(replacePrefix + "#", replacePrefix); + String replacement = (replacePrefix + substr + replaceSuffix).replace("()", "").replace(replacePrefix + "#", + replacePrefix); matcher.appendReplacement(result, replacement); } matcher.appendTail(result); return result.toString(); } + } diff --git a/src/test/java/io/lettuce/codec/CRC16UnitTests.java b/src/test/java/io/lettuce/codec/CRC16UnitTests.java index 6d51a0bd57..5f8ae13c22 100644 --- a/src/test/java/io/lettuce/codec/CRC16UnitTests.java +++ b/src/test/java/io/lettuce/codec/CRC16UnitTests.java @@ -40,6 +40,7 @@ void testCRC16(Fixture fixture) { static class Fixture { final byte[] bytes; + final int expected; Fixture(byte[] bytes, int expected) { @@ -51,5 +52,7 @@ static class Fixture { public String toString() { return "Expects 0x" + Integer.toHexString(expected).toUpperCase(); } + } + } diff --git a/src/test/java/io/lettuce/core/AbstractRedisClientTest.java b/src/test/java/io/lettuce/core/AbstractRedisClientTest.java index f73c5083f8..b7a338baec 100644 --- a/src/test/java/io/lettuce/core/AbstractRedisClientTest.java +++ b/src/test/java/io/lettuce/core/AbstractRedisClientTest.java @@ -34,6 +34,7 @@ public abstract class AbstractRedisClientTest extends TestSupport { protected static RedisClient client; + protected RedisCommands redis; @BeforeAll @@ -81,4 +82,5 @@ public void closeConnection() throws Exception { redis.getStatefulConnection().close(); } } + } diff --git a/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java index af5b21b5ba..35e23a7b52 100644 --- a/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/AsyncConnectionIntegrationTests.java @@ -47,7 +47,9 @@ class AsyncConnectionIntegrationTests extends TestSupport { private final RedisClient client; + private final StatefulRedisConnection connection; + private final RedisAsyncCommands async; @Inject @@ -126,10 +128,12 @@ void futureListenerCompleted() { final List run = new ArrayList<>(); Runnable listener = new Runnable() { + @Override public void run() { run.add(new Object()); } + }; RedisAsyncCommands connection = client.connect().async(); @@ -173,4 +177,5 @@ void awaitAllTimeout() { Future> blpop = async.blpop(1, key); assertThat(Futures.await(1, TimeUnit.NANOSECONDS, blpop)).isFalse(); } + } diff --git a/src/test/java/io/lettuce/core/ByteBufferCodec.java b/src/test/java/io/lettuce/core/ByteBufferCodec.java index 4a46fdd9a9..f84b10c347 100644 --- a/src/test/java/io/lettuce/core/ByteBufferCodec.java +++ b/src/test/java/io/lettuce/core/ByteBufferCodec.java @@ -34,4 +34,5 @@ public ByteBuffer encodeKey(ByteBuffer key) { public ByteBuffer encodeValue(ByteBuffer value) { return value.asReadOnlyBuffer(); } + } diff --git a/src/test/java/io/lettuce/core/ClientMetricsIntegrationTests.java b/src/test/java/io/lettuce/core/ClientMetricsIntegrationTests.java index 05ff559d0a..55a9fd26f1 100644 --- a/src/test/java/io/lettuce/core/ClientMetricsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ClientMetricsIntegrationTests.java @@ -63,4 +63,5 @@ private void generateTestData(RedisCommands redis) { redis.get(key); redis.get(key); } + } diff --git a/src/test/java/io/lettuce/core/ClientOptionsIntegrationTests.java b/src/test/java/io/lettuce/core/ClientOptionsIntegrationTests.java index b3b2a84b02..347ec18e92 100644 --- a/src/test/java/io/lettuce/core/ClientOptionsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ClientOptionsIntegrationTests.java @@ -548,4 +548,5 @@ void authenticatedPingBeforeConnectWithQueuedCommandsAndReconnect() { redisConnection.close(); }); } + } diff --git a/src/test/java/io/lettuce/core/ClientOptionsUnitTests.java b/src/test/java/io/lettuce/core/ClientOptionsUnitTests.java index 3446caaf81..e7a29c6bb9 100644 --- a/src/test/java/io/lettuce/core/ClientOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/ClientOptionsUnitTests.java @@ -59,4 +59,5 @@ void checkAssertions(ClientOptions sut) { assertThat(sut.isSuspendReconnectOnProtocolFailure()).isFalse(); assertThat(sut.getDisconnectedBehavior()).isEqualTo(ClientOptions.DisconnectedBehavior.DEFAULT); } + } diff --git a/src/test/java/io/lettuce/core/ConnectMethodsIntegrationTests.java b/src/test/java/io/lettuce/core/ConnectMethodsIntegrationTests.java index 7461b5da76..a5879a4758 100644 --- a/src/test/java/io/lettuce/core/ConnectMethodsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ConnectMethodsIntegrationTests.java @@ -17,6 +17,7 @@ class ConnectMethodsIntegrationTests { private final RedisClient redisClient; + private final RedisClusterClient clusterClient; @Inject diff --git a/src/test/java/io/lettuce/core/ConnectionFutureUnitTests.java b/src/test/java/io/lettuce/core/ConnectionFutureUnitTests.java index bc3807a3ab..68f434ac77 100644 --- a/src/test/java/io/lettuce/core/ConnectionFutureUnitTests.java +++ b/src/test/java/io/lettuce/core/ConnectionFutureUnitTests.java @@ -63,7 +63,6 @@ void composeTransformShouldFailWhileTransformationRetainOriginalException() { Throwable t = new Throwable(); foo.completeExceptionally(t); - assertThat(transformed.toCompletableFuture()).isDone(); assertThat(transformed.toCompletableFuture()).isCompletedExceptionally(); @@ -106,7 +105,8 @@ void shouldComposeWithErrorFlow() { assertThat(transformed2.toCompletableFuture()).isDone(); assertThat(transformed2.toCompletableFuture()).isCompletedExceptionally(); - assertThatThrownBy(transformed2::join).hasCauseInstanceOf(IllegalStateException.class).hasRootCauseInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(transformed2::join).hasCauseInstanceOf(IllegalStateException.class) + .hasRootCauseInstanceOf(IllegalArgumentException.class); } + } diff --git a/src/test/java/io/lettuce/core/CustomCodecIntegrationTests.java b/src/test/java/io/lettuce/core/CustomCodecIntegrationTests.java index c68377344f..94fa64205d 100644 --- a/src/test/java/io/lettuce/core/CustomCodecIntegrationTests.java +++ b/src/test/java/io/lettuce/core/CustomCodecIntegrationTests.java @@ -30,7 +30,9 @@ class CustomCodecIntegrationTests extends TestSupport { private final SecretKeySpec secretKey = new SecretKeySpec("1234567890123456".getBytes(), "AES"); + private final IvParameterSpec iv = new IvParameterSpec("1234567890123456".getBytes()); + // Creates a CryptoCipher instance with the transformation and properties. private final String transform = "AES/CBC/PKCS5Padding"; @@ -205,9 +207,11 @@ public ByteBuffer encodeValue(Object value) { return null; } } + } static class Person implements Serializable { } + } diff --git a/src/test/java/io/lettuce/core/ExceptionFactoryUnitTests.java b/src/test/java/io/lettuce/core/ExceptionFactoryUnitTests.java index dd73b86f84..41af0392f5 100644 --- a/src/test/java/io/lettuce/core/ExceptionFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/ExceptionFactoryUnitTests.java @@ -63,8 +63,8 @@ void shouldCreateExecutionException() { assertThat(ExceptionFactory.createExecutionException("ERR foo bar", new IllegalStateException())) .isInstanceOf(RedisCommandExecutionException.class).hasMessage("ERR foo bar") .hasRootCauseInstanceOf(IllegalStateException.class); - assertThat(ExceptionFactory.createExecutionException(null, new IllegalStateException())).isInstanceOf( - RedisCommandExecutionException.class).hasRootCauseInstanceOf(IllegalStateException.class); + assertThat(ExceptionFactory.createExecutionException(null, new IllegalStateException())) + .isInstanceOf(RedisCommandExecutionException.class).hasRootCauseInstanceOf(IllegalStateException.class); } @Test @@ -106,10 +106,11 @@ void shouldFormatExactUnits() { @Test void shouldFormatToMinmalApplicableTimeunit() { - assertThat(ExceptionFactory.formatTimeout(Duration.ofMinutes(2).plus(Duration.ofSeconds(10)))).isEqualTo( - "130 second(s)"); - assertThat(ExceptionFactory.formatTimeout(Duration.ofSeconds(2).plus(Duration.ofMillis(5)))).isEqualTo( - "2005 millisecond(s)"); + assertThat(ExceptionFactory.formatTimeout(Duration.ofMinutes(2).plus(Duration.ofSeconds(10)))) + .isEqualTo("130 second(s)"); + assertThat(ExceptionFactory.formatTimeout(Duration.ofSeconds(2).plus(Duration.ofMillis(5)))) + .isEqualTo("2005 millisecond(s)"); assertThat(ExceptionFactory.formatTimeout(Duration.ofNanos(2))).isEqualTo("2 ns"); } + } diff --git a/src/test/java/io/lettuce/core/GeoModelUnitTests.java b/src/test/java/io/lettuce/core/GeoModelUnitTests.java index 2aa55cb8e9..35e75bd2cf 100644 --- a/src/test/java/io/lettuce/core/GeoModelUnitTests.java +++ b/src/test/java/io/lettuce/core/GeoModelUnitTests.java @@ -82,4 +82,5 @@ void geoCoordinatesSlightlyDifferent() { assertThat(sut.toString()).isNotEqualTo(slightlyDifferent.toString()); } + } diff --git a/src/test/java/io/lettuce/core/KeyValueUnitTests.java b/src/test/java/io/lettuce/core/KeyValueUnitTests.java index 42c5dac759..08191831d7 100644 --- a/src/test/java/io/lettuce/core/KeyValueUnitTests.java +++ b/src/test/java/io/lettuce/core/KeyValueUnitTests.java @@ -122,4 +122,5 @@ void toStringShouldRenderCorrectly() { KeyValue kv(String key, String value) { return KeyValue.just(key, value); } + } diff --git a/src/test/java/io/lettuce/core/LimitUnitTests.java b/src/test/java/io/lettuce/core/LimitUnitTests.java index c8f9417519..d4d6490e3f 100644 --- a/src/test/java/io/lettuce/core/LimitUnitTests.java +++ b/src/test/java/io/lettuce/core/LimitUnitTests.java @@ -28,4 +28,5 @@ void unlimited() { assertThat(limit.getCount()).isEqualTo(-1); assertThat(limit.isLimited()).isFalse(); } + } diff --git a/src/test/java/io/lettuce/core/PipeliningIntegrationTests.java b/src/test/java/io/lettuce/core/PipeliningIntegrationTests.java index 8138a31cc0..b0ba4a3544 100644 --- a/src/test/java/io/lettuce/core/PipeliningIntegrationTests.java +++ b/src/test/java/io/lettuce/core/PipeliningIntegrationTests.java @@ -27,6 +27,7 @@ class PipeliningIntegrationTests extends TestSupport { private final RedisClient client; + private final StatefulRedisConnection connection; @Inject @@ -109,4 +110,5 @@ String value(int i) { String key(int i) { return key + "-" + i; } + } diff --git a/src/test/java/io/lettuce/core/ProtectedModeTests.java b/src/test/java/io/lettuce/core/ProtectedModeTests.java index 1b2c9493a0..490e6d99d7 100644 --- a/src/test/java/io/lettuce/core/ProtectedModeTests.java +++ b/src/test/java/io/lettuce/core/ProtectedModeTests.java @@ -27,6 +27,7 @@ class ProtectedModeTests { private static MockTcpServer server; + private static RedisClient client; @BeforeAll @@ -36,6 +37,7 @@ static void beforeClass() throws Exception { server.addHandler(() -> { return new ChannelInboundHandlerAdapter() { + @Override public void channelActive(ChannelHandlerContext ctx) { @@ -49,6 +51,7 @@ public void channelActive(ChannelHandlerContext ctx) { ctx.close(); }); } + }; }); @@ -106,8 +109,8 @@ void regularClientFailsOnFirstCommandWithDelay() { void connectFailsOnPing() { client.setOptions(ClientOptions.builder().build()); - assertThatThrownBy(() -> client.connect()).isInstanceOf(RedisConnectionException.class).hasCauseInstanceOf( - RedisConnectionException.class); + assertThatThrownBy(() -> client.connect()).isInstanceOf(RedisConnectionException.class) + .hasCauseInstanceOf(RedisConnectionException.class); } private static String getMessage() { @@ -125,4 +128,5 @@ private static String getMessage() { + "things in order for the server to start accepting connections from the outside."; } + } diff --git a/src/test/java/io/lettuce/core/RangeUnitTests.java b/src/test/java/io/lettuce/core/RangeUnitTests.java index 941270497c..5341c65ba4 100644 --- a/src/test/java/io/lettuce/core/RangeUnitTests.java +++ b/src/test/java/io/lettuce/core/RangeUnitTests.java @@ -97,4 +97,5 @@ void lessOrEquals() { assertThat(lte.getUpper().getValue()).isEqualTo("zero"); assertThat(lte.toString()).isEqualTo("Range [[unbounded] to [zero]"); } + } diff --git a/src/test/java/io/lettuce/core/ReactiveBackpressurePropagationUnitTests.java b/src/test/java/io/lettuce/core/ReactiveBackpressurePropagationUnitTests.java index 72b6a2467d..2a1e701fb1 100644 --- a/src/test/java/io/lettuce/core/ReactiveBackpressurePropagationUnitTests.java +++ b/src/test/java/io/lettuce/core/ReactiveBackpressurePropagationUnitTests.java @@ -39,6 +39,7 @@ class ReactiveBackpressurePropagationUnitTests { private CommandHandler commandHandler; + private EmbeddedChannel embeddedChannel; @Mock @@ -183,6 +184,7 @@ static byte[] arrayHeader(int count) { static byte[] bulkString(String string) { return String.format("$%d\r\n%s\r\n", string.getBytes().length, string).getBytes(); } + } } diff --git a/src/test/java/io/lettuce/core/ReactiveConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/ReactiveConnectionIntegrationTests.java index 66af01406d..6b26c79295 100644 --- a/src/test/java/io/lettuce/core/ReactiveConnectionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ReactiveConnectionIntegrationTests.java @@ -59,7 +59,9 @@ class ReactiveConnectionIntegrationTests extends TestSupport { private final StatefulRedisConnection connection; + private final RedisCommands redis; + private final RedisReactiveCommands reactive; @Inject @@ -250,6 +252,7 @@ public void onError(Throwable e) { @Override public void onNext(String s) { } + }; } @@ -280,5 +283,7 @@ public void onError(Throwable e) { public void onNext(Object o) { result.add(o); } + } + } diff --git a/src/test/java/io/lettuce/core/ReactiveStreamingOutputIntegrationTests.java b/src/test/java/io/lettuce/core/ReactiveStreamingOutputIntegrationTests.java index 490f70d556..98549b93ae 100644 --- a/src/test/java/io/lettuce/core/ReactiveStreamingOutputIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ReactiveStreamingOutputIntegrationTests.java @@ -29,6 +29,7 @@ class ReactiveStreamingOutputIntegrationTests extends TestSupport { private final RedisCommands redis; + private final RedisReactiveCommands reactive; @Inject @@ -82,16 +83,12 @@ void geoWithinListCommandShouldReturnAllElements() { redis.geoadd(key, 50, 20, "value1"); redis.geoadd(key, 50, 21, "value2"); - StepVerifier - .create(reactive.georadius(key, 50, 20, 1000, Unit.km, new GeoArgs().withHash())) - .recordWith(ArrayList::new) - .expectNextCount(2) - .consumeRecordedWith( - values -> { - assertThat(values).hasSize(2).contains(new GeoWithin<>("value1", null, 3542523898362974L, null), - new GeoWithin<>("value2", null, 3542609801095198L, null)); + StepVerifier.create(reactive.georadius(key, 50, 20, 1000, Unit.km, new GeoArgs().withHash())).recordWith(ArrayList::new) + .expectNextCount(2).consumeRecordedWith(values -> { + assertThat(values).hasSize(2).contains(new GeoWithin<>("value1", null, 3542523898362974L, null), + new GeoWithin<>("value2", null, 3542609801095198L, null)); - }).verifyComplete(); + }).verifyComplete(); } @Test @@ -103,4 +100,5 @@ void geoCoordinatesListCommandShouldReturnAllElements() { StepVerifier.create(reactive.geopos(key, "value1", "value2")).expectNextCount(2).verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/RedisClientConnectIntegrationTests.java b/src/test/java/io/lettuce/core/RedisClientConnectIntegrationTests.java index d0bb44f842..83e2c351e3 100644 --- a/src/test/java/io/lettuce/core/RedisClientConnectIntegrationTests.java +++ b/src/test/java/io/lettuce/core/RedisClientConnectIntegrationTests.java @@ -136,7 +136,7 @@ void shutdownSyncInRedisFutureTest() { CompletableFuture f = connection.async().get("key1").whenComplete((result, e) -> { connection.close(); redisClient.shutdown(0, 0, SECONDS); // deadlock expected. - }).toCompletableFuture(); + }).toCompletableFuture(); assertThatThrownBy(() -> TestFutures.awaitOrTimeout(f)).isInstanceOf(TimeoutException.class); } @@ -200,8 +200,7 @@ void connectPubSubCodecOwnUri() { @Test void connectPubSubAsync() { RedisURI redisURI = redis(host, port).build(); - ConnectionFuture> future = client.connectPubSubAsync( -UTF8, redisURI); + ConnectionFuture> future = client.connectPubSubAsync(UTF8, redisURI); StatefulRedisPubSubConnection connection = future.join(); assertThat(connection.getTimeout()).isEqualTo(redisURI.getTimeout()); connection.close(); @@ -278,4 +277,5 @@ private static RedisURI invalidSentinel() { return redisURI; } + } diff --git a/src/test/java/io/lettuce/core/RedisClientFactoryUnitTests.java b/src/test/java/io/lettuce/core/RedisClientFactoryUnitTests.java index d16f0b1613..20351373d5 100644 --- a/src/test/java/io/lettuce/core/RedisClientFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisClientFactoryUnitTests.java @@ -15,6 +15,7 @@ class RedisClientFactoryUnitTests { private static final String URI = "redis://" + TestSettings.host() + ":" + TestSettings.port(); + private static final RedisURI REDIS_URI = RedisURI.create(URI); @Test @@ -59,8 +60,8 @@ void clientResourcesWithStringUri() { @Test void clientResourcesWithStringUriNull() { - assertThatThrownBy(() -> RedisClient.create(TestClientResources.get(), (String) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClient.create(TestClientResources.get(), (String) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -70,17 +71,18 @@ void clientResourcesNullWithStringUri() { @Test void clientResourcesWithUri() { - FastShutdown.shutdown(RedisClient.create(TestClientResources.get(), REDIS_URI)); + FastShutdown.shutdown(RedisClient.create(TestClientResources.get(), REDIS_URI)); } @Test void clientResourcesWithUriNull() { - assertThatThrownBy(() -> RedisClient.create(TestClientResources.get(), (RedisURI) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClient.create(TestClientResources.get(), (RedisURI) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test void clientResourcesNullWithUri() { assertThatThrownBy(() -> RedisClient.create(null, REDIS_URI)).isInstanceOf(IllegalArgumentException.class); } + } diff --git a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java index 22a8671745..42c411f7a9 100644 --- a/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/RedisClientIntegrationTests.java @@ -139,10 +139,8 @@ void shouldPropagateCommandTimeoutToCommandListener() throws InterruptedExceptio assertThat(commandListener.succeeded).isEmpty(); Wait.untilTrue(() -> commandListener.failed.size() == 1); - Wait.untilTrue(() -> - commandListener.failed.stream().anyMatch(command -> - command.getCommand().getType().equals(CommandType.BLPOP))); - + Wait.untilTrue(() -> commandListener.failed.stream() + .anyMatch(command -> command.getCommand().getType().equals(CommandType.BLPOP))); FastShutdown.shutdown(client); } @@ -215,8 +213,11 @@ private Map, EventExecutorGroup> getExecutor private class TestConnectionListener implements RedisConnectionStateListener { volatile SocketAddress onConnectedSocketAddress; + volatile RedisChannelHandler onConnected; + volatile RedisChannelHandler onDisconnected; + volatile RedisChannelHandler onException; @Override @@ -234,6 +235,7 @@ public void onRedisDisconnected(RedisChannelHandler connection) { public void onRedisExceptionCaught(RedisChannelHandler connection, Throwable cause) { onException = connection; } + } static class TestCommandListener implements CommandListener { @@ -266,4 +268,5 @@ public void commandFailed(CommandFailedEvent event) { } } + } diff --git a/src/test/java/io/lettuce/core/RedisClientListenerIntegrationTests.java b/src/test/java/io/lettuce/core/RedisClientListenerIntegrationTests.java index 1e8b2dcf54..478d5a1700 100644 --- a/src/test/java/io/lettuce/core/RedisClientListenerIntegrationTests.java +++ b/src/test/java/io/lettuce/core/RedisClientListenerIntegrationTests.java @@ -12,5 +12,4 @@ @ExtendWith(LettuceExtension.class) class RedisClientListenerIntegrationTests extends TestSupport { - } diff --git a/src/test/java/io/lettuce/core/RedisClientUnitTests.java b/src/test/java/io/lettuce/core/RedisClientUnitTests.java index 4614519091..608035e43c 100644 --- a/src/test/java/io/lettuce/core/RedisClientUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisClientUnitTests.java @@ -88,4 +88,5 @@ void shutdownShutsDownResourcesAfterChannels() throws Exception { verify(clientResources).shutdown(anyLong(), anyLong(), any()); assertThat(future).isDone(); } + } diff --git a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java index 01b5be2241..b29d81ad21 100644 --- a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java @@ -16,11 +16,14 @@ * @author Mark Paluch */ class RedisCommandBuilderUnitTests { + public static final String MY_KEY = "hKey"; + public static final String MY_FIELD1 = "hField1"; + public static final String MY_FIELD2 = "hField2"; - public static final String MY_FIELD3 = "hField3"; + public static final String MY_FIELD3 = "hField3"; RedisCommandBuilder sut = new RedisCommandBuilder<>(StringCodec.UTF8); @@ -37,27 +40,25 @@ void shouldCorrectlyConstructXreadgroup() { @Test void shouldCorrectlyConstructHexpire() { - Command command = - sut.hexpire(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); + Command command = sut.hexpire(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*8\r\n" + "$7\r\n" + "HEXPIRE\r\n" + "$4\r\n" - + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" - + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo( + "*8\r\n" + "$7\r\n" + "HEXPIRE\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test void shouldCorrectlyConstructHexpireat() { - Command command = - sut.hexpireat(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); + Command command = sut.hexpireat(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*8\r\n" + "$9\r\n" + "HEXPIREAT\r\n" + "$4\r\n" - + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" - + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo( + "*8\r\n" + "$9\r\n" + "HEXPIREAT\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test @@ -67,9 +68,9 @@ void shouldCorrectlyConstructHexpiretime() { ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$11\r\n" + "HEXPIRETIME\r\n" + "$4\r\n" - + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" - + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)) + .isEqualTo("*6\r\n" + "$11\r\n" + "HEXPIRETIME\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test @@ -79,8 +80,8 @@ void shouldCorrectlyConstructHpersist() { ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$8\r\n" + "HPERSIST\r\n" + "$4\r\n" - + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" - + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$8\r\n" + "HPERSIST\r\n" + "$4\r\n" + "hKey\r\n" + + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } + } diff --git a/src/test/java/io/lettuce/core/ScanArgsUnitTests.java b/src/test/java/io/lettuce/core/ScanArgsUnitTests.java index 8bb1228580..2d655c3637 100644 --- a/src/test/java/io/lettuce/core/ScanArgsUnitTests.java +++ b/src/test/java/io/lettuce/core/ScanArgsUnitTests.java @@ -22,4 +22,5 @@ void shouldEncodeMatchUsingUtf8() { assertThat(commandArgs.toCommandString()).isEqualTo("MATCH w7Y="); } + } diff --git a/src/test/java/io/lettuce/core/ScanCursorUnitTests.java b/src/test/java/io/lettuce/core/ScanCursorUnitTests.java index d00e06de17..8cdeec4334 100644 --- a/src/test/java/io/lettuce/core/ScanCursorUnitTests.java +++ b/src/test/java/io/lettuce/core/ScanCursorUnitTests.java @@ -26,4 +26,5 @@ void setCursorOnImmutableInstance() { void setFinishedOnImmutableInstance() { assertThatThrownBy(() -> ScanCursor.INITIAL.setFinished(false)).isInstanceOf(UnsupportedOperationException.class); } + } diff --git a/src/test/java/io/lettuce/core/ScanIteratorIntegrationTests.java b/src/test/java/io/lettuce/core/ScanIteratorIntegrationTests.java index 31cabb1870..c3b5a8e203 100644 --- a/src/test/java/io/lettuce/core/ScanIteratorIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ScanIteratorIntegrationTests.java @@ -126,8 +126,7 @@ void hscanNovaluesShouldThrowNoSuchElementExceptionOnEmpty() { redis.mset(KeysAndValues.MAP); - ScanIterator scan = ScanIterator.hscanNovalues(redis, "none", - ScanArgs.Builder.limit(50).match("key-foo")); + ScanIterator scan = ScanIterator.hscanNovalues(redis, "none", ScanArgs.Builder.limit(50).match("key-foo")); assertThat(scan.hasNext()).isFalse(); try { @@ -162,8 +161,7 @@ void hashNoValuesSinglePass() { redis.hmset(key, KeysAndValues.MAP); - ScanIterator scan = ScanIterator.hscanNovalues(redis, key, - ScanArgs.Builder.limit(50).match("key-11*")); + ScanIterator scan = ScanIterator.hscanNovalues(redis, key, ScanArgs.Builder.limit(50).match("key-11*")); assertThat(scan.hasNext()).isTrue(); assertThat(scan.hasNext()).isTrue(); @@ -187,8 +185,8 @@ void hashMultiPass() { List> keys = scan.stream().collect(Collectors.toList()); - assertThat(keys).containsAll( - KeysAndValues.KEYS.stream().map(s -> KeyValue.fromNullable(s, KeysAndValues.MAP.get(s))).collect(Collectors.toList())); + assertThat(keys).containsAll(KeysAndValues.KEYS.stream().map(s -> KeyValue.fromNullable(s, KeysAndValues.MAP.get(s))) + .collect(Collectors.toList())); } @Test @@ -208,8 +206,7 @@ void sscanShouldThrowNoSuchElementExceptionOnEmpty() { redis.sadd(key, KeysAndValues.VALUES.toArray(new String[0])); - ScanIterator scan = ScanIterator.sscan(redis, "none", - ScanArgs.Builder.limit(50).match("key-foo")); + ScanIterator scan = ScanIterator.sscan(redis, "none", ScanArgs.Builder.limit(50).match("key-foo")); assertThat(scan.hasNext()).isFalse(); try { @@ -225,8 +222,7 @@ void setSinglePass() { redis.sadd(key, KeysAndValues.KEYS.toArray(new String[0])); - ScanIterator scan = ScanIterator.sscan(redis, key, - ScanArgs.Builder.limit(50).match("key-11*")); + ScanIterator scan = ScanIterator.sscan(redis, key, ScanArgs.Builder.limit(50).match("key-11*")); assertThat(scan.hasNext()).isTrue(); assertThat(scan.hasNext()).isTrue(); @@ -258,9 +254,7 @@ void zscanShouldThrowNoSuchElementExceptionOnEmpty() { redis.zadd(key, ScoredValue.just(i, KeysAndValues.KEYS.get(i))); } - - ScanIterator> scan = ScanIterator.zscan(redis, "none", - ScanArgs.Builder.limit(50).match("key-foo")); + ScanIterator> scan = ScanIterator.zscan(redis, "none", ScanArgs.Builder.limit(50).match("key-foo")); assertThat(scan.hasNext()).isFalse(); try { @@ -278,8 +272,7 @@ void zsetSinglePass() { redis.zadd(key, ScoredValue.just(i, KeysAndValues.KEYS.get(i))); } - ScanIterator> scan = ScanIterator.zscan(redis, key, - ScanArgs.Builder.limit(50).match("key-11*")); + ScanIterator> scan = ScanIterator.zscan(redis, key, ScanArgs.Builder.limit(50).match("key-11*")); assertThat(scan.hasNext()).isTrue(); assertThat(scan.hasNext()).isTrue(); @@ -308,4 +301,5 @@ void zsetMultiPass() { assertThat(values).containsAll(values); } + } diff --git a/src/test/java/io/lettuce/core/ScanStreamIntegrationTests.java b/src/test/java/io/lettuce/core/ScanStreamIntegrationTests.java index 1dc7a22628..f527eafcb7 100644 --- a/src/test/java/io/lettuce/core/ScanStreamIntegrationTests.java +++ b/src/test/java/io/lettuce/core/ScanStreamIntegrationTests.java @@ -46,6 +46,7 @@ class ScanStreamIntegrationTests extends TestSupport { private final StatefulRedisConnection connection; + private final RedisCommands redis; @Inject @@ -176,4 +177,5 @@ void shouldCorrectlyEmitKeysWithConcurrentPoll() { assertThat(redis.scard(targetKey)).isEqualTo(5_000); } + } diff --git a/src/test/java/io/lettuce/core/ScoredValueStreamingAdapter.java b/src/test/java/io/lettuce/core/ScoredValueStreamingAdapter.java index 9d2c980f86..ae9ef8f2a4 100644 --- a/src/test/java/io/lettuce/core/ScoredValueStreamingAdapter.java +++ b/src/test/java/io/lettuce/core/ScoredValueStreamingAdapter.java @@ -10,6 +10,7 @@ * @since 3.0 */ public class ScoredValueStreamingAdapter implements ScoredValueStreamingChannel { + private List> list = new ArrayList<>(); @Override @@ -20,4 +21,5 @@ public void onValue(ScoredValue value) { public List> getList() { return list; } + } diff --git a/src/test/java/io/lettuce/core/ScoredValueUnitTests.java b/src/test/java/io/lettuce/core/ScoredValueUnitTests.java index 98114db288..3a786971e3 100644 --- a/src/test/java/io/lettuce/core/ScoredValueUnitTests.java +++ b/src/test/java/io/lettuce/core/ScoredValueUnitTests.java @@ -124,4 +124,5 @@ void toStringShouldRenderCorrectly() { assertThat(value.toString()).contains("ScoredValue[12").contains("340000, hello]"); assertThat(empty.toString()).contains(String.format("ScoredValue[%f].empty", 0d)); } + } diff --git a/src/test/java/io/lettuce/core/SocketOptionsIntegrationTests.java b/src/test/java/io/lettuce/core/SocketOptionsIntegrationTests.java index 82a3f275d0..a7f7e2a548 100644 --- a/src/test/java/io/lettuce/core/SocketOptionsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/SocketOptionsIntegrationTests.java @@ -50,4 +50,5 @@ void testConnectTimeout() { } } } + } diff --git a/src/test/java/io/lettuce/core/SocketOptionsUnitTests.java b/src/test/java/io/lettuce/core/SocketOptionsUnitTests.java index 1554efa6f0..57aee0a22f 100644 --- a/src/test/java/io/lettuce/core/SocketOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/SocketOptionsUnitTests.java @@ -102,9 +102,11 @@ void testDefaultTcpUserTimeoutOption() { @Test void testConfigTcpUserTimeoutOption() { - SocketOptions sut = SocketOptions.builder().tcpUserTimeout(TcpUserTimeoutOptions - .builder().enable().tcpUserTimeout(Duration.ofSeconds(60)).build()).build(); + SocketOptions sut = SocketOptions.builder() + .tcpUserTimeout(TcpUserTimeoutOptions.builder().enable().tcpUserTimeout(Duration.ofSeconds(60)).build()) + .build(); assertThat(sut.isEnableTcpUserTimeout()).isTrue(); assertThat(sut.getTcpUserTimeout().getTcpUserTimeout()).isEqualTo(Duration.ofSeconds(60)); } + } diff --git a/src/test/java/io/lettuce/core/SslIntegrationTests.java b/src/test/java/io/lettuce/core/SslIntegrationTests.java index 098ee9eb80..cee9db988a 100644 --- a/src/test/java/io/lettuce/core/SslIntegrationTests.java +++ b/src/test/java/io/lettuce/core/SslIntegrationTests.java @@ -63,9 +63,13 @@ class SslIntegrationTests extends TestSupport { private static final String KEYSTORE = "work/keystore.jks"; + private static final String TRUSTSTORE = "work/truststore.jks"; + private static final File TRUSTSTORE_FILE = new File(TRUSTSTORE); + private static final File CA_CERT_FILE = new File("work/ca/certs/ca.cert.pem"); + private static final int MASTER_SLAVE_BASE_PORT_OFFSET = 2000; private static final RedisURI URI_VERIFY = sslURIBuilder(0) // @@ -74,8 +78,7 @@ class SslIntegrationTests extends TestSupport { private static final RedisURI URI_VERIFY_IMPOSSIBLE_TIMEOUT = sslURIBuilder(0) // .withVerifyPeer(true) // - .withTimeout(Duration.ZERO) - .build(); + .withTimeout(Duration.ZERO).build(); private static final RedisURI URI_NO_VERIFY = sslURIBuilder(1) // .withVerifyPeer(false) // @@ -430,4 +433,5 @@ private void verifyMasterSlaveConnection(List redisUris) { connection.sync().ping(); } } + } diff --git a/src/test/java/io/lettuce/core/SslOptionsUnitTests.java b/src/test/java/io/lettuce/core/SslOptionsUnitTests.java index c4733fea34..c134da39a8 100644 --- a/src/test/java/io/lettuce/core/SslOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/SslOptionsUnitTests.java @@ -82,4 +82,5 @@ void shouldApplyContextCustomizer() throws Exception { SslContext context = options.createSslContextBuilder().build(); assertThat(context.cipherSuites()).containsOnly("TLS_RSA_WITH_AES_128_CBC_SHA"); } + } diff --git a/src/test/java/io/lettuce/core/SyncAsyncApiConvergenceUnitTests.java b/src/test/java/io/lettuce/core/SyncAsyncApiConvergenceUnitTests.java index 13474aa25d..e033b7cf7b 100644 --- a/src/test/java/io/lettuce/core/SyncAsyncApiConvergenceUnitTests.java +++ b/src/test/java/io/lettuce/core/SyncAsyncApiConvergenceUnitTests.java @@ -61,7 +61,8 @@ void testSameResultType(Method syncMethod) throws Exception { } } - assertThat(returnType.toString()).describedAs(syncMethod.toString()).isEqualTo( - syncMethod.getGenericReturnType().toString()); + assertThat(returnType.toString()).describedAs(syncMethod.toString()) + .isEqualTo(syncMethod.getGenericReturnType().toString()); } + } diff --git a/src/test/java/io/lettuce/core/TestRedisPublisher.java b/src/test/java/io/lettuce/core/TestRedisPublisher.java index cd730345e7..a774c15c60 100644 --- a/src/test/java/io/lettuce/core/TestRedisPublisher.java +++ b/src/test/java/io/lettuce/core/TestRedisPublisher.java @@ -19,4 +19,5 @@ public TestRedisPublisher(Supplier> redisCommandSupplier, boolean dissolve) { super(redisCommandSupplier, connection, dissolve, ImmediateEventExecutor.INSTANCE); } + } diff --git a/src/test/java/io/lettuce/core/TestSupport.java b/src/test/java/io/lettuce/core/TestSupport.java index 389f3a2e05..7eb1b892b2 100644 --- a/src/test/java/io/lettuce/core/TestSupport.java +++ b/src/test/java/io/lettuce/core/TestSupport.java @@ -33,7 +33,9 @@ public abstract class TestSupport { public static final String host = TestSettings.hostAddr(); + public static final int port = TestSettings.port(); + public static final String username = TestSettings.username(); public static final CharSequence passwd = TestSettings.password(); @@ -43,6 +45,7 @@ public abstract class TestSupport { public static final CharSequence aclPasswd = TestSettings.aclPassword(); public static final String key = "key"; + public static final String value = "value"; protected static List list(String... args) { @@ -72,4 +75,5 @@ protected static ScoredValue sv(double score, long value) { protected static Set set(String... args) { return LettuceSets.newHashSet(args); } + } diff --git a/src/test/java/io/lettuce/core/TimeoutOptionsUnitTests.java b/src/test/java/io/lettuce/core/TimeoutOptionsUnitTests.java index 4ef823f540..dd0ae8f4a1 100644 --- a/src/test/java/io/lettuce/core/TimeoutOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/TimeoutOptionsUnitTests.java @@ -43,4 +43,5 @@ void fixedConnectionTimeout() { assertThat(timeoutOptions.isApplyConnectionTimeout()).isFalse(); assertThat(source.getTimeout(null)).isEqualTo(TimeUnit.MINUTES.toNanos(1)); } + } diff --git a/src/test/java/io/lettuce/core/UnixDomainSocketIntegrationTests.java b/src/test/java/io/lettuce/core/UnixDomainSocketIntegrationTests.java index ae96c80554..ba440b03c6 100644 --- a/src/test/java/io/lettuce/core/UnixDomainSocketIntegrationTests.java +++ b/src/test/java/io/lettuce/core/UnixDomainSocketIntegrationTests.java @@ -32,7 +32,9 @@ class UnixDomainSocketIntegrationTests { private static RedisClient sentinelClient; private Logger log = LogManager.getLogger(getClass()); + private String key = "key"; + private String value = "value"; @BeforeAll @@ -169,8 +171,7 @@ private static RedisClient getRedisSentinelClient() { private void assumeTestSupported() { String osName = SystemPropertyUtil.get("os.name").toLowerCase(Locale.UK).trim(); assumeTrue(Transports.NativeTransports.isDomainSocketSupported(), - "Only supported on Linux/OSX, your os is " + osName - + " with epoll/kqueue support."); + "Only supported on Linux/OSX, your os is " + osName + " with epoll/kqueue support."); } private static RedisURI getSocketRedisUri() throws IOException { diff --git a/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java b/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java index 42326ca1c0..2feb8d11b5 100644 --- a/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java +++ b/src/test/java/io/lettuce/core/Utf8StringCodecIntegrationTests.java @@ -51,4 +51,5 @@ void decodeHugeBuffer(StatefulRedisConnection connection) { redis.set(key, value); assertThat(redis.get(key)).isEqualTo(value); } + } diff --git a/src/test/java/io/lettuce/core/ValueUnitTests.java b/src/test/java/io/lettuce/core/ValueUnitTests.java index e3af0fbe68..f78b355091 100644 --- a/src/test/java/io/lettuce/core/ValueUnitTests.java +++ b/src/test/java/io/lettuce/core/ValueUnitTests.java @@ -126,8 +126,8 @@ void emptyValueGetValueOrElseShouldThrowException() { Value value = Value.from(Optional.empty()); - assertThatThrownBy(() -> value.getValueOrElseThrow(IllegalArgumentException::new)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> value.getValueOrElseThrow(IllegalArgumentException::new)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -263,4 +263,5 @@ void streamShouldCreateAStream() { assertThat(empty.stream().count()).isEqualTo(1); } + } diff --git a/src/test/java/io/lettuce/core/ZAggregateArgsUnitTests.java b/src/test/java/io/lettuce/core/ZAggregateArgsUnitTests.java index a7abfe56db..1973c6393b 100644 --- a/src/test/java/io/lettuce/core/ZAggregateArgsUnitTests.java +++ b/src/test/java/io/lettuce/core/ZAggregateArgsUnitTests.java @@ -48,4 +48,5 @@ void shouldOmitWeights() { assertThat(args.toString()).doesNotContain("WEIGHTS"); } + } diff --git a/src/test/java/io/lettuce/core/cluster/AdvancedClusterClientIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/AdvancedClusterClientIntegrationTests.java index bdebd0b21c..64c5a04fab 100644 --- a/src/test/java/io/lettuce/core/cluster/AdvancedClusterClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/AdvancedClusterClientIntegrationTests.java @@ -70,11 +70,15 @@ class AdvancedClusterClientIntegrationTests extends TestSupport { private static final String KEY_ON_NODE_1 = "a"; + private static final String KEY_ON_NODE_2 = "b"; private final RedisClusterClient clusterClient; + private final StatefulRedisClusterConnection clusterConnection; + private final RedisAdvancedClusterAsyncCommands async; + private final RedisAdvancedClusterCommands sync; @Inject @@ -137,8 +141,8 @@ void differentConnections() { for (RedisClusterNode redisClusterNode : clusterClient.getPartitions()) { StatefulRedisConnection nodeId = statefulConnection.getConnection(redisClusterNode.getNodeId()); - StatefulRedisConnection hostAndPort = statefulConnection.getConnection(redisClusterNode.getUri() - .getHost(), redisClusterNode.getUri().getPort()); + StatefulRedisConnection hostAndPort = statefulConnection + .getConnection(redisClusterNode.getUri().getHost(), redisClusterNode.getUri().getPort()); assertThat(nodeId).isNotSameAs(hostAndPort); } @@ -326,10 +330,10 @@ void dbSize() { writeKeysToTwoNodes(); - RedisClusterCommands nodeConnection1 = clusterConnection.getConnection(ClusterTestSettings.host, - ClusterTestSettings.port1).sync(); - RedisClusterCommands nodeConnection2 = clusterConnection.getConnection(ClusterTestSettings.host, - ClusterTestSettings.port1).sync(); + RedisClusterCommands nodeConnection1 = clusterConnection + .getConnection(ClusterTestSettings.host, ClusterTestSettings.port1).sync(); + RedisClusterCommands nodeConnection2 = clusterConnection + .getConnection(ClusterTestSettings.host, ClusterTestSettings.port1).sync(); assertThat(nodeConnection1.dbsize()).isEqualTo(1); assertThat(nodeConnection2.dbsize()).isEqualTo(1); @@ -652,8 +656,8 @@ void clusterScanStreamingWithArgs() { } } while (!scanCursor.isFinished()); - assertThat(adapter.getList()).containsAll( - KeysAndValues.KEYS.stream().filter(k -> k.startsWith("a")).collect(Collectors.toList())); + assertThat(adapter.getList()) + .containsAll(KeysAndValues.KEYS.stream().filter(k -> k.startsWith("a")).collect(Collectors.toList())); } diff --git a/src/test/java/io/lettuce/core/cluster/AdvancedClusterReactiveIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/AdvancedClusterReactiveIntegrationTests.java index b6758b580a..cfa4cc8519 100644 --- a/src/test/java/io/lettuce/core/cluster/AdvancedClusterReactiveIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/AdvancedClusterReactiveIntegrationTests.java @@ -75,10 +75,13 @@ class AdvancedClusterReactiveIntegrationTests extends TestSupport { private static final String KEY_ON_NODE_1 = "a"; + private static final String KEY_ON_NODE_2 = "b"; private final RedisClusterClient clusterClient; + private final RedisAdvancedClusterReactiveCommands commands; + private final RedisAdvancedClusterCommands syncCommands; @Inject @@ -498,4 +501,5 @@ Map prepareMset() { } return mset; } + } diff --git a/src/test/java/io/lettuce/core/cluster/AsyncConnectionProviderIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/AsyncConnectionProviderIntegrationTests.java index ba92d9c3ce..c2352a7898 100644 --- a/src/test/java/io/lettuce/core/cluster/AsyncConnectionProviderIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/AsyncConnectionProviderIntegrationTests.java @@ -60,8 +60,11 @@ class AsyncConnectionProviderIntegrationTests { private final ClientResources resources; + private RedisClusterClient client; + private ServerSocket serverSocket; + private CountDownLatch connectInitiated = new CountDownLatch(1); private AsyncConnectionProvider, ConnectionFuture>> sut; @@ -79,6 +82,7 @@ void before() throws Exception { client = RedisClusterClient.create(resources, "redis://localhost"); client.setOptions(ClusterClientOptions.builder().protocolVersion(ProtocolVersion.RESP2).build()); sut = new AsyncConnectionProvider<>(new AbstractClusterNodeConnectionFactory(resources) { + @Override public ConnectionFuture> apply(ConnectionKey connectionKey) { @@ -92,6 +96,7 @@ public ConnectionFuture> apply(Connectio return future; } + }); } @@ -103,8 +108,7 @@ void after() throws Exception { @Test void shouldCloseConnectionByKey() throws IOException { - ConnectionKey connectionKey = new ConnectionKey(ConnectionIntent.READ, TestSettings.host(), - TestSettings.port()); + ConnectionKey connectionKey = new ConnectionKey(ConnectionIntent.READ, TestSettings.host(), TestSettings.port()); sut.getConnection(connectionKey); sut.close(connectionKey); @@ -118,8 +122,7 @@ void shouldCloseConnectionByKey() throws IOException { @Test void shouldCloseConnections() throws IOException { - ConnectionKey connectionKey = new ConnectionKey(ConnectionIntent.READ, TestSettings.host(), - TestSettings.port()); + ConnectionKey connectionKey = new ConnectionKey(ConnectionIntent.READ, TestSettings.host(), TestSettings.port()); sut.getConnection(connectionKey); TestFutures.awaitOrTimeout(sut.close()); @@ -145,14 +148,12 @@ void connectShouldFail() throws Exception { StopWatch stopWatch = new StopWatch(); assertThatThrownBy(() -> TestFutures.awaitOrTimeout(sut.getConnection(connectionKey))) - .hasCauseInstanceOf( - ConnectTimeoutException.class); + .hasCauseInstanceOf(ConnectTimeoutException.class); stopWatch.start(); assertThatThrownBy(() -> TestFutures.awaitOrTimeout(sut.getConnection(connectionKey))) - .hasCauseInstanceOf( - ConnectTimeoutException.class); + .hasCauseInstanceOf(ConnectTimeoutException.class); stopWatch.stop(); @@ -207,4 +208,5 @@ void connectShouldFailConcurrently() throws Exception { sut.close(); socket.close(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ByteCodecClusterIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ByteCodecClusterIntegrationTests.java index b5066903d4..17f5ddd57c 100644 --- a/src/test/java/io/lettuce/core/cluster/ByteCodecClusterIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ByteCodecClusterIntegrationTests.java @@ -27,4 +27,5 @@ void testByteCodec(RedisClusterClient clusterClient) { connection.sync().set(key.getBytes(), value.getBytes()); assertThat(connection.sync().get(key.getBytes())).isEqualTo(value.getBytes()); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsIntegrationTests.java index b75954e65f..d83b7ee0cf 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsIntegrationTests.java @@ -40,8 +40,8 @@ void tearDown() { @Test void shouldApplyTimeoutOptionsToClusterConnection() throws InterruptedException { - clusterClient.setOptions(ClusterClientOptions.builder().timeoutOptions(TimeoutOptions.enabled(Duration.ofMillis(100))) - .build()); + clusterClient.setOptions( + ClusterClientOptions.builder().timeoutOptions(TimeoutOptions.enabled(Duration.ofMillis(100))).build()); try (StatefulRedisClusterConnection connection = clusterClient.connect()) { @@ -60,8 +60,8 @@ void shouldApplyTimeoutOptionsToClusterConnection() throws InterruptedException @Test void shouldApplyTimeoutOptionsToPubSubClusterConnection() throws InterruptedException { - clusterClient.setOptions(ClusterClientOptions.builder().timeoutOptions(TimeoutOptions.enabled(Duration.ofMillis(100))) - .build()); + clusterClient.setOptions( + ClusterClientOptions.builder().timeoutOptions(TimeoutOptions.enabled(Duration.ofMillis(100))).build()); try (StatefulRedisClusterPubSubConnection connection = clusterClient.connectPubSub()) { connection.setTimeout(Duration.ofMillis(100)); @@ -76,4 +76,5 @@ void shouldApplyTimeoutOptionsToPubSubClusterConnection() throws InterruptedExce Thread.sleep(300); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsUnitTests.java index 98690cd668..abd9b270c2 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterClientOptionsUnitTests.java @@ -26,8 +26,8 @@ void testCopy() { Predicate nodeFilter = it -> true; ClusterClientOptions options = ClusterClientOptions.builder().autoReconnect(false).requestQueueSize(100) .suspendReconnectOnProtocolFailure(true).maxRedirects(1234).validateClusterNodeMembership(false) - .readOnlyCommands(command -> command.getType() == CommandType.PING) - .protocolVersion(ProtocolVersion.RESP2).nodeFilter(nodeFilter).build(); + .readOnlyCommands(command -> command.getType() == CommandType.PING).protocolVersion(ProtocolVersion.RESP2) + .nodeFilter(nodeFilter).build(); ClusterClientOptions copy = ClusterClientOptions.copyOf(options); @@ -102,4 +102,5 @@ void builderFromClusterClientOptions() { assertThat(copy.getReadOnlyCommands().isReadOnly(new Command<>(CommandType.PING, null))).isTrue(); assertThat(options.mutate()).isNotSameAs(copy.mutate()); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterCommandIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ClusterCommandIntegrationTests.java index 3c29bdbdf4..2cdff16990 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterCommandIntegrationTests.java @@ -39,9 +39,13 @@ class ClusterCommandIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisClusterClient clusterClient; + private final StatefulRedisConnection connection; + private final RedisClusterAsyncCommands async; + private final RedisClusterCommands sync; @Inject @@ -186,8 +190,8 @@ void readOnly() throws Exception { prepareReadonlyTest(key); // assume cluster node 3 is a replica for the master 1 - RedisCommands connect3 = client - .connect(RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()).sync(); + RedisCommands connect3 = client.connect(RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()) + .sync(); assertThat(connect3.readOnly()).isEqualTo("OK"); waitUntilValueIsVisible(key, connect3); @@ -209,8 +213,8 @@ void readOnlyWithReconnect() throws Exception { prepareReadonlyTest(key); // assume cluster node 3 is a replica for the master 1 - RedisCommands connect3 = client - .connect(RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()).sync(); + RedisCommands connect3 = client.connect(RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()) + .sync(); assertThat(connect3.readOnly()).isEqualTo("OK"); connect3.quit(); @@ -229,8 +233,8 @@ void readOnlyReadWrite() throws Exception { prepareReadonlyTest(key); // assume cluster node 3 is a replica for the master 1 - final RedisCommands connect3 = client.connect( - RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()).sync(); + final RedisCommands connect3 = client + .connect(RedisURI.Builder.redis(host, ClusterTestSettings.port3).build()).sync(); try { connect3.get("b"); @@ -279,4 +283,5 @@ private void prepareReadonlyTest(String key) { private static void waitUntilValueIsVisible(String key, RedisCommands commands) { Wait.untilTrue(() -> commands.get(key) != null).waitOrTimeout(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterCommandUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterCommandUnitTests.java index 561fd4b4b2..2c028f0b39 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterCommandUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterCommandUnitTests.java @@ -30,6 +30,7 @@ class ClusterCommandUnitTests { private RedisChannelWriter writerMock; private ClusterCommand sut; + private Command command = new Command<>(CommandType.TYPE, new StatusOutput<>(StringCodec.UTF8), null); @@ -100,4 +101,5 @@ void testCompleteListener() { assertThat(sut.isCompleted()).isTrue(); assertThat(someList.size()).describedAs("Inner listener has to add one element").isEqualTo(1); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterDistributionChannelWriterUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterDistributionChannelWriterUnitTests.java index 95b6806350..f76d481c00 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterDistributionChannelWriterUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterDistributionChannelWriterUnitTests.java @@ -127,7 +127,8 @@ void shouldParseIPv6AskTargetCorrectly() { @Test void shouldParseMovedTargetCorrectly() { - HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(new Partitions(), "MOVED 1234-2020 127.0.0.1:6381"); + HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(new Partitions(), + "MOVED 1234-2020 127.0.0.1:6381"); assertThat(moveTarget.getHostText()).isEqualTo("127.0.0.1"); assertThat(moveTarget.getPort()).isEqualTo(6381); @@ -137,7 +138,8 @@ void shouldParseMovedTargetCorrectly() { void shouldParseMovedTargetWithoutHostnameCorrectly() { Partitions partitions = new Partitions(); - partitions.add(new RedisClusterNode(RedisURI.create("redis://1.2.3.4:6381"), "foo", false,null,0,0,0,Collections.emptyList(), Collections.emptySet())); + partitions.add(new RedisClusterNode(RedisURI.create("redis://1.2.3.4:6381"), "foo", false, null, 0, 0, 0, + Collections.emptyList(), Collections.emptySet())); HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(partitions, "MOVED 1234 :6381"); assertThat(moveTarget.getHostText()).isEqualTo("1.2.3.4"); @@ -148,7 +150,8 @@ void shouldParseMovedTargetWithoutHostnameCorrectly() { void shouldParseMovedTargetWithoutHostnameUsingSlotFallbackCorrectly() { Partitions partitions = new Partitions(); - partitions.add(new RedisClusterNode(RedisURI.create("redis://1.2.3.4:5678"), "foo", false,null,0,0,0, Collections.singletonList(1234), Collections.emptySet())); + partitions.add(new RedisClusterNode(RedisURI.create("redis://1.2.3.4:5678"), "foo", false, null, 0, 0, 0, + Collections.singletonList(1234), Collections.emptySet())); HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(partitions, "MOVED 1234 :6381"); assertThat(moveTarget.getHostText()).isEqualTo("1.2.3.4"); @@ -158,7 +161,8 @@ void shouldParseMovedTargetWithoutHostnameUsingSlotFallbackCorrectly() { @Test void shouldParseIPv6MovedTargetCorrectly() { - HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(new Partitions(), "MOVED 1234-2020 1:2:3:4::6:6381"); + HostAndPort moveTarget = ClusterDistributionChannelWriter.getMoveTarget(new Partitions(), + "MOVED 1234-2020 1:2:3:4::6:6381"); assertThat(moveTarget.getHostText()).isEqualTo("1:2:3:4::6"); assertThat(moveTarget.getPort()).isEqualTo(6381); @@ -167,7 +171,8 @@ void shouldParseIPv6MovedTargetCorrectly() { @Test void shouldReturnIntentForWriteCommand() { - ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, clientOptions, clusterEventListener); + ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, + clientOptions, clusterEventListener); RedisCommand set = new Command<>(CommandType.SET, null); RedisCommand mset = new Command<>(CommandType.MSET, null); @@ -180,7 +185,8 @@ void shouldReturnIntentForWriteCommand() { @Test void shouldReturnDefaultIntentForNoCommands() { - ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, clientOptions, clusterEventListener); + ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, + clientOptions, clusterEventListener); assertThat(writer.getIntent(Collections.emptyList())).isEqualTo(ConnectionIntent.WRITE); } @@ -188,7 +194,8 @@ void shouldReturnDefaultIntentForNoCommands() { @Test void shouldReturnIntentForReadCommand() { - ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, clientOptions, clusterEventListener); + ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, + clientOptions, clusterEventListener); RedisCommand get = new Command<>(CommandType.GET, null); RedisCommand mget = new Command<>(CommandType.MGET, null); @@ -201,7 +208,8 @@ void shouldReturnIntentForReadCommand() { @Test void shouldReturnIntentForMixedCommands() { - ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, clientOptions, clusterEventListener); + ClusterDistributionChannelWriter writer = new ClusterDistributionChannelWriter(clusterDistributionChannelWriter, + clientOptions, clusterEventListener); RedisCommand set = new Command<>(CommandType.SET, null); RedisCommand mget = new Command<>(CommandType.MGET, null); @@ -265,4 +273,5 @@ private void verifyWriteCommandCountWhenRedirecting(boolean isMoved) { verify(clusterNodeEndpoint, never()).write(ArgumentMatchers.> any()); } } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterNodeEndpointUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterNodeEndpointUnitTests.java index a8da42cca2..524526457d 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterNodeEndpointUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterNodeEndpointUnitTests.java @@ -145,4 +145,5 @@ private void prepareNewEndpoint() { sut = new ClusterNodeEndpoint(clientOptions, clientResources, clusterChannelWriter); disconnectedBuffer = (Queue) ReflectionTestUtils.getField(sut, "disconnectedBuffer"); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterPartiallyDownIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ClusterPartiallyDownIntegrationTests.java index 6adee0f591..8f103c0861 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterPartiallyDownIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterPartiallyDownIntegrationTests.java @@ -32,13 +32,19 @@ class ClusterPartiallyDownIntegrationTests extends TestSupport { private static ClientResources clientResources; private static int port1 = 7579; + private static int port2 = 7580; + private static int port3 = 7581; + private static int port4 = 7582; private static final RedisURI URI_1 = RedisURI.create(TestSettings.host(), port1); + private static final RedisURI URI_2 = RedisURI.create(TestSettings.host(), port2); + private static final RedisURI URI_3 = RedisURI.create(TestSettings.host(), port3); + private static final RedisURI URI_4 = RedisURI.create(TestSettings.host(), port4); private RedisClusterClient redisClusterClient; @@ -120,4 +126,5 @@ void partitionNodesAreOffline() { assertThat(e).hasRootCauseInstanceOf(IOException.class); } } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ClusterReactiveCommandIntegrationTests.java index 80cd5bebbc..74ddc18d0d 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterReactiveCommandIntegrationTests.java @@ -25,7 +25,9 @@ class ClusterReactiveCommandIntegrationTests { private final RedisClusterClient clusterClient; + private final RedisClusterReactiveCommands reactive; + private final RedisClusterCommands sync; @Inject @@ -94,4 +96,5 @@ void clusterSlaves() { assertThat(result.size()).isGreaterThan(0); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterSetup.java b/src/test/java/io/lettuce/core/cluster/ClusterSetup.java index da8f75cd13..9bfb500591 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterSetup.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterSetup.java @@ -117,8 +117,7 @@ public static void setupMasterWithReplica(ClusterTestHelper clusterHelper) { Wait.untilTrue(clusterHelper::isStable).waitOrTimeout(); TestFutures.awaitOrTimeout(connection.getConnection(ClusterTestSettings.host, ClusterTestSettings.port6) - .clusterReplicate( - node1.clusterMyId())); + .clusterReplicate(node1.clusterMyId())); clusterHelper.getClusterClient().reloadPartitions(); @@ -131,8 +130,7 @@ public static void setupMasterWithReplica(ClusterTestHelper clusterHelper) { Wait.untilEquals(1L, () -> { clusterHelper.getClusterClient().reloadPartitions(); return partitionStream(clusterHelper) - .filter(redisClusterNode -> redisClusterNode.is(RedisClusterNode.NodeFlag.REPLICA)) - .count(); + .filter(redisClusterNode -> redisClusterNode.is(RedisClusterNode.NodeFlag.REPLICA)).count(); }).waitOrTimeout(); connection.getStatefulConnection().close(); diff --git a/src/test/java/io/lettuce/core/cluster/ClusterTestHelper.java b/src/test/java/io/lettuce/core/cluster/ClusterTestHelper.java index a526b0355c..4383d5fb38 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterTestHelper.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterTestHelper.java @@ -45,13 +45,15 @@ class ClusterTestHelper { private final RedisClusterClient clusterClient; + private final Map> connectionCache = new HashMap<>(); public ClusterTestHelper(RedisClusterClient clusterClient, int... ports) { this.clusterClient = clusterClient; for (int port : ports) { - RedisAsyncCommands connection = clusterClient.connectToNode(new InetSocketAddress("localhost", port)).async(); + RedisAsyncCommands connection = clusterClient + .connectToNode(new InetSocketAddress("localhost", port)).async(); connectionCache.put(port, connection); } } @@ -140,8 +142,8 @@ private void onAllConnections(Function, Futu } } - private void await(List> futures, boolean ignoreExecutionException) throws InterruptedException, - java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException { + private void await(List> futures, boolean ignoreExecutionException) + throws InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException { for (Future future : futures) { try { future.get(10, TimeUnit.SECONDS); @@ -152,4 +154,5 @@ private void await(List> futures, boolean ignoreExecutionException) th } } } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterTestSettings.java b/src/test/java/io/lettuce/core/cluster/ClusterTestSettings.java index 261f686080..dc28e5b54a 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterTestSettings.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterTestSettings.java @@ -11,22 +11,30 @@ public abstract class ClusterTestSettings extends TestSupport { public static final String host = TestSettings.hostAddr(); public static final int SLOT_A = SlotHash.getSlot("a".getBytes()); + public static final int SLOT_B = SlotHash.getSlot("b".getBytes()); // default test cluster 2 masters + 2 slaves public static final int port1 = TestSettings.port(900); + public static final int port2 = port1 + 1; + public static final int port3 = port1 + 2; + public static final int port4 = port1 + 3; // master+replica or master+master public static final int port5 = port1 + 4; + public static final int port6 = port1 + 5; // auth cluster public static final int port7 = port1 + 6; + public static final String KEY_A = "a"; + public static final String KEY_B = "b"; + public static final String KEY_D = "d"; /** diff --git a/src/test/java/io/lettuce/core/cluster/ClusterTestUtil.java b/src/test/java/io/lettuce/core/cluster/ClusterTestUtil.java index 26c3ca8956..b59be06b82 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterTestUtil.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterTestUtil.java @@ -75,9 +75,9 @@ public static RedisCommands redisCommandsOverCluster( StatefulRedisClusterConnection connection) { StatefulRedisClusterConnectionImpl clusterConnection = (StatefulRedisClusterConnectionImpl) connection; - InvocationHandler h = new RoutingInvocationHandler(connection.async(), - clusterConnection.syncInvocationHandler()); + InvocationHandler h = new RoutingInvocationHandler(connection.async(), clusterConnection.syncInvocationHandler()); return (RedisCommands) Proxy.newProxyInstance(ClusterTestUtil.class.getClassLoader(), new Class[] { RedisCommands.class }, h); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ClusterTopologyRefreshSchedulerUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterTopologyRefreshSchedulerUnitTests.java index 4e6907564a..6872005898 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterTopologyRefreshSchedulerUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterTopologyRefreshSchedulerUnitTests.java @@ -273,4 +273,5 @@ void shouldRetrievePartitionsViaAdaptiveRefreshTriggeredEvent() { assertThat(capture.getPartitions()).isSameAs(partitions); } + } diff --git a/src/test/java/io/lettuce/core/cluster/CommandSetIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/CommandSetIntegrationTests.java index a29bdcb0f8..05c2c32263 100644 --- a/src/test/java/io/lettuce/core/cluster/CommandSetIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/CommandSetIntegrationTests.java @@ -48,5 +48,7 @@ enum UnknownCommand implements ProtocolKeyword { public byte[] getBytes() { return name().getBytes(); } + } + } diff --git a/src/test/java/io/lettuce/core/cluster/HealthyMajorityPartitionsConsensusUnitTests.java b/src/test/java/io/lettuce/core/cluster/HealthyMajorityPartitionsConsensusUnitTests.java index 588db9bdc4..2fa3597cd0 100644 --- a/src/test/java/io/lettuce/core/cluster/HealthyMajorityPartitionsConsensusUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/HealthyMajorityPartitionsConsensusUnitTests.java @@ -21,9 +21,13 @@ class HealthyMajorityPartitionsConsensusUnitTests { private RedisClusterNode node1 = createNode(1); + private RedisClusterNode node2 = createNode(2); + private RedisClusterNode node3 = createNode(3); + private RedisClusterNode node4 = createNode(4); + private RedisClusterNode node5 = createNode(5); @Test @@ -94,4 +98,5 @@ void splitUnhealthyNodeViewShouldDecideForHealthyNodes() { assertThat(Arrays.asList(partitions1, partitions3)).contains(result); } + } diff --git a/src/test/java/io/lettuce/core/cluster/KnownMajorityPartitionsConsensusUnitTests.java b/src/test/java/io/lettuce/core/cluster/KnownMajorityPartitionsConsensusUnitTests.java index dc2dcc9932..95af7f54f6 100644 --- a/src/test/java/io/lettuce/core/cluster/KnownMajorityPartitionsConsensusUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/KnownMajorityPartitionsConsensusUnitTests.java @@ -20,9 +20,13 @@ class KnownMajorityPartitionsConsensusUnitTests { private RedisClusterNode node1 = createNode(1); + private RedisClusterNode node2 = createNode(2); + private RedisClusterNode node3 = createNode(3); + private RedisClusterNode node4 = createNode(4); + private RedisClusterNode node5 = createNode(5); @Test @@ -120,4 +124,5 @@ void strangeClusterSplitViewShouldDecideForKnownMajority() { assertThat(Arrays.asList(partitions1, partitions2, partitions3)).contains(result); } + } diff --git a/src/test/java/io/lettuce/core/cluster/NodeSelectionAsyncIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/NodeSelectionAsyncIntegrationTests.java index 9ded3df028..ec2faf90d8 100644 --- a/src/test/java/io/lettuce/core/cluster/NodeSelectionAsyncIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/NodeSelectionAsyncIntegrationTests.java @@ -43,6 +43,7 @@ class NodeSelectionAsyncIntegrationTests extends TestSupport { private final RedisClusterClient clusterClient; + private final RedisAdvancedClusterAsyncCommands commands; @Inject @@ -120,15 +121,15 @@ void testNodeSelectionCount() { assertThat(commands.slaves().size()).isEqualTo(2); assertThat(commands.masters().size()).isEqualTo(2); - assertThat(commands.nodes(redisClusterNode -> redisClusterNode.is(RedisClusterNode.NodeFlag.MYSELF)).size()).isEqualTo( - 1); + assertThat(commands.nodes(redisClusterNode -> redisClusterNode.is(RedisClusterNode.NodeFlag.MYSELF)).size()) + .isEqualTo(1); } @Test void testNodeSelection() { - AsyncNodeSelection onlyMe = commands.nodes(redisClusterNode -> redisClusterNode.getFlags().contains( - RedisClusterNode.NodeFlag.MYSELF)); + AsyncNodeSelection onlyMe = commands + .nodes(redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF)); Map> map = onlyMe.asMap(); assertThat(map).hasSize(1); @@ -146,19 +147,19 @@ void testNodeSelection() { void testDynamicNodeSelection() { Partitions partitions = commands.getStatefulConnection().getPartitions(); - partitions.forEach(redisClusterNode -> redisClusterNode.setFlags(Collections - .singleton(RedisClusterNode.NodeFlag.UPSTREAM))); + partitions.forEach( + redisClusterNode -> redisClusterNode.setFlags(Collections.singleton(RedisClusterNode.NodeFlag.UPSTREAM))); - AsyncNodeSelection selection = commands.nodes( - redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF), true); + AsyncNodeSelection selection = commands + .nodes(redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF), true); assertThat(selection.asMap()).hasSize(0); - partitions.getPartition(0).setFlags( - LettuceSets.unmodifiableSet(RedisClusterNode.NodeFlag.MYSELF, RedisClusterNode.NodeFlag.UPSTREAM)); + partitions.getPartition(0) + .setFlags(LettuceSets.unmodifiableSet(RedisClusterNode.NodeFlag.MYSELF, RedisClusterNode.NodeFlag.UPSTREAM)); assertThat(selection.asMap()).hasSize(1); - partitions.getPartition(1).setFlags( - LettuceSets.unmodifiableSet(RedisClusterNode.NodeFlag.MYSELF, RedisClusterNode.NodeFlag.UPSTREAM)); + partitions.getPartition(1) + .setFlags(LettuceSets.unmodifiableSet(RedisClusterNode.NodeFlag.MYSELF, RedisClusterNode.NodeFlag.UPSTREAM)); assertThat(selection.asMap()).hasSize(2); clusterClient.reloadPartitions(); @@ -167,8 +168,8 @@ void testDynamicNodeSelection() { @Test void testNodeSelectionAsyncPing() { - AsyncNodeSelection onlyMe = commands.nodes(redisClusterNode -> redisClusterNode.getFlags().contains( - RedisClusterNode.NodeFlag.MYSELF)); + AsyncNodeSelection onlyMe = commands + .nodes(redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF)); Map> map = onlyMe.asMap(); assertThat(map).hasSize(1); @@ -212,8 +213,8 @@ void testDispatchWithArgs() { @Test void testStaticNodeSelection() { - AsyncNodeSelection selection = commands.nodes( - redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF), false); + AsyncNodeSelection selection = commands + .nodes(redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.MYSELF), false); assertThat(selection.asMap()).hasSize(1); @@ -225,12 +226,11 @@ void testStaticNodeSelection() { clusterClient.reloadPartitions(); } - @Test void testReplicaReadWrite() { - AsyncNodeSelection nodes = commands.nodes(redisClusterNode -> redisClusterNode.getFlags().contains( - RedisClusterNode.NodeFlag.REPLICA)); + AsyncNodeSelection nodes = commands + .nodes(redisClusterNode -> redisClusterNode.getFlags().contains(RedisClusterNode.NodeFlag.REPLICA)); assertThat(nodes.size()).isEqualTo(2); @@ -255,8 +255,8 @@ void testReplicaReadWrite() { @Test void testReplicasWithReadOnly() { - AsyncNodeSelection nodes = commands.replicas(redisClusterNode -> redisClusterNode - .is(RedisClusterNode.NodeFlag.REPLICA)); + AsyncNodeSelection nodes = commands + .replicas(redisClusterNode -> redisClusterNode.is(RedisClusterNode.NodeFlag.REPLICA)); assertThat(nodes.size()).isEqualTo(2); @@ -285,8 +285,7 @@ void waitForReplication(String key, int port) { waitForReplication(commands, key, port); } - static void waitForReplication(RedisAdvancedClusterAsyncCommands commands, String key, int port) - { + static void waitForReplication(RedisAdvancedClusterAsyncCommands commands, String key, int port) { AsyncNodeSelection selection = commands .replicas(redisClusterNode -> redisClusterNode.getUri().getPort() == port); @@ -303,4 +302,5 @@ static void waitForReplication(RedisAdvancedClusterAsyncCommands return null; }).waitOrTimeout(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/PartitionsConsensusTestSupport.java b/src/test/java/io/lettuce/core/cluster/PartitionsConsensusTestSupport.java index 340b3a787e..a8187aa8fc 100644 --- a/src/test/java/io/lettuce/core/cluster/PartitionsConsensusTestSupport.java +++ b/src/test/java/io/lettuce/core/cluster/PartitionsConsensusTestSupport.java @@ -12,7 +12,7 @@ class PartitionsConsensusTestSupport { static RedisClusterNode createNode(int nodeId) { - return new RedisClusterNode(RedisURI.create("localhost", 6379-2020 + nodeId), "" + nodeId, true, "", 0, 0, 0, + return new RedisClusterNode(RedisURI.create("localhost", 6379 - 2020 + nodeId), "" + nodeId, true, "", 0, 0, 0, Collections.emptyList(), new HashSet<>()); } @@ -34,4 +34,5 @@ static Map createMap(Partitions... partitionses) { return partitionsMap; } + } diff --git a/src/test/java/io/lettuce/core/cluster/PipelinedRedisFutureUnitTests.java b/src/test/java/io/lettuce/core/cluster/PipelinedRedisFutureUnitTests.java index 95d3549e70..578201423b 100644 --- a/src/test/java/io/lettuce/core/cluster/PipelinedRedisFutureUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/PipelinedRedisFutureUnitTests.java @@ -38,4 +38,5 @@ void testCompleteExceptionally() { assertThat(TestFutures.getOrTimeout(sut.toCompletableFuture())).isEqualTo(other); assertThat(sut.getError()).isNull(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/PooledClusterConnectionProviderUnitTests.java b/src/test/java/io/lettuce/core/cluster/PooledClusterConnectionProviderUnitTests.java index 78901e1b4a..52ae370cc9 100644 --- a/src/test/java/io/lettuce/core/cluster/PooledClusterConnectionProviderUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/PooledClusterConnectionProviderUnitTests.java @@ -109,10 +109,10 @@ void before() { List slots1 = IntStream.range(0, 8192).boxed().collect(Collectors.toList()); List slots2 = IntStream.range(8192, SlotHash.SLOT_COUNT).boxed().collect(Collectors.toList()); - partitions.add(new RedisClusterNode(RedisURI.create("localhost", 1), "1", true, null, 0, 0, 0, slots1, Collections - .singleton(RedisClusterNode.NodeFlag.UPSTREAM))); - partitions.add(new RedisClusterNode(RedisURI.create("localhost", 2), "2", true, "1", 0, 0, 0, slots2, Collections - .singleton(RedisClusterNode.NodeFlag.REPLICA))); + partitions.add(new RedisClusterNode(RedisURI.create("localhost", 1), "1", true, null, 0, 0, 0, slots1, + Collections.singleton(RedisClusterNode.NodeFlag.UPSTREAM))); + partitions.add(new RedisClusterNode(RedisURI.create("localhost", 2), "2", true, "1", 0, 0, 0, slots2, + Collections.singleton(RedisClusterNode.NodeFlag.REPLICA))); sut.setPartitions(partitions); @@ -123,8 +123,7 @@ void before() { void shouldObtainConnection() { when(clientMock.connectToNodeAsync(eq(StringCodec.UTF8), eq("localhost:1"), any(), any())) - .thenReturn( - ConnectionFuture.from(socketAddressMock, CompletableFuture.completedFuture(nodeConnectionMock))); + .thenReturn(ConnectionFuture.from(socketAddressMock, CompletableFuture.completedFuture(nodeConnectionMock))); StatefulRedisConnection connection = sut.getConnection(ConnectionIntent.READ, 1); @@ -138,8 +137,7 @@ void shouldObtainConnection() { void shouldReuseMasterConnectionForReadFromMaster() { when(clientMock.connectToNodeAsync(eq(StringCodec.UTF8), eq("localhost:1"), any(), any())) - .thenReturn( - ConnectionFuture.from(socketAddressMock, CompletableFuture.completedFuture(nodeConnectionMock))); + .thenReturn(ConnectionFuture.from(socketAddressMock, CompletableFuture.completedFuture(nodeConnectionMock))); sut.setReadFrom(ReadFrom.UPSTREAM); @@ -186,7 +184,8 @@ void shouldAvoidReplicaWithReplOffsetZero() { sut.setReadFrom(ReadFrom.REPLICA); - assertThatExceptionOfType(PartitionSelectorException.class).isThrownBy(() -> sut.getConnection(ConnectionIntent.READ, 1)); + assertThatExceptionOfType(PartitionSelectorException.class) + .isThrownBy(() -> sut.getConnection(ConnectionIntent.READ, 1)); } @Test @@ -388,10 +387,12 @@ void shouldNotifyListerOnUncoveredReadSlot() { void shouldNotifyListerOnUncoveredReadSlotAfterSelection() { sut.setReadFrom(new ReadFrom() { + @Override public List select(Nodes nodes) { return Collections.emptyList(); } + }); sut.getConnectionAsync(ConnectionIntent.READ, 2); @@ -418,7 +419,8 @@ void shouldCloseConnections() { @Test void shouldRejectConnectionsToUnknownNodeId() { - assertThatThrownBy(() -> sut.getConnection(ConnectionIntent.READ, "foobar")).isInstanceOf(UnknownPartitionException.class); + assertThatThrownBy(() -> sut.getConnection(ConnectionIntent.READ, "foobar")) + .isInstanceOf(UnknownPartitionException.class); verify(clusterEventListener).onUnknownNode(); } @@ -431,4 +433,5 @@ void shouldRejectConnectionsToUnknownNodeHostAndPort() { verify(clusterEventListener).onUnknownNode(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ReadFromUnitTests.java b/src/test/java/io/lettuce/core/cluster/ReadFromUnitTests.java index 89888646c3..3ee0b59450 100644 --- a/src/test/java/io/lettuce/core/cluster/ReadFromUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ReadFromUnitTests.java @@ -47,8 +47,11 @@ class ReadFromUnitTests { private Partitions sut = new Partitions(); + private RedisClusterNode nearest = new RedisClusterNode(); + private RedisClusterNode master = new RedisClusterNode(); + private RedisClusterNode replica = new RedisClusterNode(); @BeforeEach @@ -259,6 +262,7 @@ void valueOfRegex() { private ReadFrom.Nodes getNodes() { return new ReadFrom.Nodes() { + @Override public List getNodes() { return (List) sut.getPartitions(); @@ -268,6 +272,7 @@ public List getNodes() { public Iterator iterator() { return getNodes().iterator(); } + }; } diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterClientFactoryTests.java b/src/test/java/io/lettuce/core/cluster/RedisClusterClientFactoryTests.java index f55a4cad56..f8741e0a78 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterClientFactoryTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterClientFactoryTests.java @@ -19,7 +19,9 @@ class RedisClusterClientFactoryTests { private static final String URI = "redis://" + TestSettings.host() + ":" + TestSettings.port(); + private static final RedisURI REDIS_URI = RedisURI.create(URI); + private static final List REDIS_URIS = LettuceLists.newList(REDIS_URI); @Test @@ -49,8 +51,8 @@ void withUriIterable() { @Test void withUriIterableNull() { - assertThatThrownBy(() -> RedisClusterClient.create((Iterable) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient.create((Iterable) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -60,8 +62,8 @@ void clientResourcesWithStringUri() { @Test void clientResourcesWithStringUriNull() { - assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (String) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (String) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -76,8 +78,8 @@ void clientResourcesWithUri() { @Test void clientResourcesWithUriNull() { - assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (RedisURI) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (RedisURI) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -92,8 +94,8 @@ void clientResourcesWithUriIterable() { @Test void clientResourcesWithUriIterableNull() { - assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (Iterable) null)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient.create(TestClientResources.get(), (Iterable) null)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -103,16 +105,16 @@ void clientResourcesNullWithUriIterable() { @Test void clientWithDifferentSslSettings() { - assertThatThrownBy( - () -> RedisClusterClient.create(Arrays.asList(RedisURI.create("redis://host1"), - RedisURI.create("redis+ssl://host1")))).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient + .create(Arrays.asList(RedisURI.create("redis://host1"), RedisURI.create("redis+ssl://host1")))) + .isInstanceOf(IllegalArgumentException.class); } @Test void clientWithDifferentTlsSettings() { - assertThatThrownBy( - () -> RedisClusterClient.create(Arrays.asList(RedisURI.create("rediss://host1"), - RedisURI.create("redis+tls://host1")))).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> RedisClusterClient + .create(Arrays.asList(RedisURI.create("rediss://host1"), RedisURI.create("redis+tls://host1")))) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -123,4 +125,5 @@ void clientWithDifferentVerifyPeerSettings() { assertThatThrownBy(() -> RedisClusterClient.create(Arrays.asList(redisURI, RedisURI.create("rediss://host1")))) .isInstanceOf(IllegalArgumentException.class); } + } diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterPasswordSecuredSslIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/RedisClusterPasswordSecuredSslIntegrationTests.java index 59e0ee55dd..4d02a8fa5c 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterPasswordSecuredSslIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterPasswordSecuredSslIntegrationTests.java @@ -32,13 +32,16 @@ class RedisClusterPasswordSecuredSslIntegrationTests extends TestSupport { private static final int CLUSTER_PORT_SSL_1 = 7442; private static final int CLUSTER_PORT_SSL_2 = 7444; // replica cannot replicate properly with upstream + private static final int CLUSTER_PORT_SSL_3 = 7445; private static final String SLOT_1_KEY = "8HMdi"; + private static final String SLOT_16352_KEY = "UyAa4KqoWgPGKa"; private static RedisURI redisURI = RedisURI.Builder.redis(host(), CLUSTER_PORT_SSL_1).withPassword("foobared").withSsl(true) .withVerifyPeer(false).build(); + private static RedisClusterClient redisClient = RedisClusterClient.create(TestClientResources.get(), redisURI); @BeforeEach @@ -157,4 +160,5 @@ void clusterNodeRefreshWorksForMultipleIterations() { redisClient.reloadPartitions(); redisClient.reloadPartitions(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterReadFromIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/RedisClusterReadFromIntegrationTests.java index b6e05ed1f9..d3543b7c40 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterReadFromIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterReadFromIntegrationTests.java @@ -45,7 +45,9 @@ class RedisClusterReadFromIntegrationTests extends TestSupport { private final RedisClusterClient clusterClient; + private StatefulRedisClusterConnection connection; + private RedisAdvancedClusterCommands sync; @Inject diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterSetupTest.java b/src/test/java/io/lettuce/core/cluster/RedisClusterSetupTest.java index dd02aece4e..ce956e0dea 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterSetupTest.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterSetupTest.java @@ -83,10 +83,13 @@ public class RedisClusterSetupTest extends TestSupport { .enablePeriodicRefresh(Duration.ofSeconds(1)).dynamicRefreshSources(false).build(); private static RedisClusterClient clusterClient; + private static RedisClient client = DefaultRedisClient.get(); + private static ClusterTestHelper clusterHelper; private RedisCommands redis1; + private RedisCommands redis2; @BeforeAll @@ -309,8 +312,8 @@ public void disconnectedConnectionRejectTest() throws Exception { assertRoutedExecution(clusterConnection); RedisClusterNode partition1 = getOwnPartition(redis1); - RedisClusterAsyncCommands node1Connection = clusterConnection.getConnection(partition1.getUri() - .getHost(), partition1.getUri().getPort()); + RedisClusterAsyncCommands node1Connection = clusterConnection + .getConnection(partition1.getUri().getHost(), partition1.getUri().getPort()); shiftAllSlotsToNode1(); @@ -321,7 +324,7 @@ public void disconnectedConnectionRejectTest() throws Exception { set.await(5, TimeUnit.SECONDS); assertThatThrownBy(() -> TestFutures.awaitOrTimeout(set)).hasRootCauseInstanceOf(RedisException.class); - clusterConnection.getStatefulConnection().close(); + clusterConnection.getStatefulConnection().close(); } @Test @@ -336,11 +339,11 @@ public void atLeastOnceForgetNodeFailover() throws Exception { RedisClusterNode partition1 = getOwnPartition(redis1); RedisClusterNode partition2 = getOwnPartition(redis2); - RedisClusterAsyncCommands node1Connection = clusterConnection.getConnection(partition1.getUri() - .getHost(), partition1.getUri().getPort()); + RedisClusterAsyncCommands node1Connection = clusterConnection + .getConnection(partition1.getUri().getHost(), partition1.getUri().getPort()); - RedisClusterAsyncCommands node2Connection = clusterConnection.getConnection(partition2.getUri() - .getHost(), partition2.getUri().getPort()); + RedisClusterAsyncCommands node2Connection = clusterConnection + .getConnection(partition2.getUri().getHost(), partition2.getUri().getPort()); shiftAllSlotsToNode1(); @@ -447,7 +450,8 @@ public void expireStaleNodeIdConnections() { ClusterSetup.setup2Masters(clusterHelper); - PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider(clusterConnection); + PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider( + clusterConnection); assertThat(clusterConnectionProvider.getConnectionCount()).isEqualTo(0); @@ -490,7 +494,8 @@ public void doNotExpireStaleNodeIdConnections() throws Exception { ClusterSetup.setup2Masters(clusterHelper); - PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider(clusterConnection); + PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider( + clusterConnection); assertThat(clusterConnectionProvider.getConnectionCount()).isEqualTo(0); @@ -528,7 +533,8 @@ public void expireStaleHostAndPortConnections() throws Exception { ClusterSetup.setup2Masters(clusterHelper); - final PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider(clusterConnection); + final PooledClusterConnectionProvider clusterConnectionProvider = getPooledClusterConnectionProvider( + clusterConnection); assertThat(clusterConnectionProvider.getConnectionCount()).isEqualTo(0); @@ -634,6 +640,7 @@ private void shiftAllSlotsToNode1() { RedisClusterNode redis2Partition = getOwnPartition(redis2); Wait.untilTrue(new Supplier() { + @Override public Boolean get() { Partitions partitions = ClusterPartitionParser.parse(redis1.clusterNodes()); @@ -653,6 +660,7 @@ private void removeRemaining(RedisClusterNode partition) { // ignore } } + }).waitOrTimeout(); redis1.clusterAddSlots(createSlots(12000, 16384)); @@ -668,4 +676,5 @@ private int[] toIntArray(List list) { private void waitForSlots(RedisClusterCommands connection, int slotCount) { Wait.untilEquals(slotCount, () -> getOwnPartition(connection).getSlots().size()).waitOrTimeout(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterStressScenariosTest.java b/src/test/java/io/lettuce/core/cluster/RedisClusterStressScenariosTest.java index 521b05c8a5..5887a7edc8 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterStressScenariosTest.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterStressScenariosTest.java @@ -59,18 +59,23 @@ public class RedisClusterStressScenariosTest extends TestSupport { private static final String host = TestSettings.hostAddr(); private static RedisClient client; + private static RedisClusterClient clusterClient; + private static ClusterTestHelper clusterHelper; private Logger log = LogManager.getLogger(getClass()); private StatefulRedisConnection redis5; + private StatefulRedisConnection redis6; private RedisCommands redissync5; + private RedisCommands redissync6; protected String key = "key"; + protected String value = "value"; @BeforeAll diff --git a/src/test/java/io/lettuce/core/cluster/RedisClusterURIUtilUnitTests.java b/src/test/java/io/lettuce/core/cluster/RedisClusterURIUtilUnitTests.java index 801417cef2..e0e707eecc 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisClusterURIUtilUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisClusterURIUtilUnitTests.java @@ -94,4 +94,5 @@ void testSslWithPasswordMultipleHosts() { assertThat(host2.getHost()).isEqualTo("host2"); assertThat(host2.getPort()).isEqualTo(6380); } + } diff --git a/src/test/java/io/lettuce/core/cluster/RedisReactiveClusterClientIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/RedisReactiveClusterClientIntegrationTests.java index ad96ced7ed..0ab13d2b0c 100644 --- a/src/test/java/io/lettuce/core/cluster/RedisReactiveClusterClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/RedisReactiveClusterClientIntegrationTests.java @@ -24,6 +24,7 @@ class RedisReactiveClusterClientIntegrationTests extends TestSupport { private final RedisAdvancedClusterCommands sync; + private final RedisAdvancedClusterReactiveCommands reactive; @Inject @@ -50,10 +51,10 @@ void getKeysInSlot() { sync.set(ClusterTestSettings.KEY_A, value); sync.set(ClusterTestSettings.KEY_B, value); - StepVerifier.create(reactive.clusterGetKeysInSlot(ClusterTestSettings.SLOT_A, 10)) - .expectNext(ClusterTestSettings.KEY_A).verifyComplete(); - StepVerifier.create(reactive.clusterGetKeysInSlot(ClusterTestSettings.SLOT_B, 10)) - .expectNext(ClusterTestSettings.KEY_B).verifyComplete(); + StepVerifier.create(reactive.clusterGetKeysInSlot(ClusterTestSettings.SLOT_A, 10)).expectNext(ClusterTestSettings.KEY_A) + .verifyComplete(); + StepVerifier.create(reactive.clusterGetKeysInSlot(ClusterTestSettings.SLOT_B, 10)).expectNext(ClusterTestSettings.KEY_B) + .verifyComplete(); } @Test @@ -97,4 +98,5 @@ void testClusterSetConfigEpoch() { assertThat(e).hasMessageContaining("ERR The user can assign a config epoch only"); }).verify(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/RoundRobinSocketAddressSupplierUnitTests.java b/src/test/java/io/lettuce/core/cluster/RoundRobinSocketAddressSupplierUnitTests.java index 8b9ca68d38..f19a3ec4ff 100644 --- a/src/test/java/io/lettuce/core/cluster/RoundRobinSocketAddressSupplierUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/RoundRobinSocketAddressSupplierUnitTests.java @@ -50,15 +50,23 @@ class RoundRobinSocketAddressSupplierUnitTests { private static RedisURI hap1 = new RedisURI("127.0.0.1", 1, Duration.ofSeconds(1)); + private static RedisURI hap2 = new RedisURI("127.0.0.1", 2, Duration.ofSeconds(1)); + private static RedisURI hap3 = new RedisURI("127.0.0.1", 3, Duration.ofSeconds(1)); + private static RedisURI hap4 = new RedisURI("127.0.0.1", 4, Duration.ofSeconds(1)); + private static RedisURI hap5 = new RedisURI("127.0.0.0", 5, Duration.ofSeconds(1)); private static InetSocketAddress addr1 = new InetSocketAddress(hap1.getHost(), hap1.getPort()); + private static InetSocketAddress addr2 = new InetSocketAddress(hap2.getHost(), hap2.getPort()); + private static InetSocketAddress addr3 = new InetSocketAddress(hap3.getHost(), hap3.getPort()); + private static InetSocketAddress addr4 = new InetSocketAddress(hap4.getHost(), hap4.getPort()); + private static InetSocketAddress addr5 = new InetSocketAddress(hap5.getHost(), hap5.getPort()); private static Partitions partitions; @@ -66,7 +74,6 @@ class RoundRobinSocketAddressSupplierUnitTests { @Mock private ClientResources clientResourcesMock; - @BeforeEach void before() { @@ -145,4 +152,5 @@ void partitionTableChangesNodeRemoved() { assertThat(sut.get()).isEqualTo(addr2); assertThat(sut.get()).isEqualTo(addr1); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ScanIteratorIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ScanIteratorIntegrationTests.java index 966878a7b6..67524a46f8 100644 --- a/src/test/java/io/lettuce/core/cluster/ScanIteratorIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ScanIteratorIntegrationTests.java @@ -53,6 +53,7 @@ class ScanIteratorIntegrationTests extends TestSupport { private final StatefulRedisClusterConnection connection; + private final RedisClusterCommands redis; @Inject @@ -149,8 +150,7 @@ void hscanNovaluesShouldThrowNoSuchElementExceptionOnEmpty() { redis.mset(KeysAndValues.MAP); - ScanIterator scan = ScanIterator.hscanNovalues(redis, "none", - ScanArgs.Builder.limit(50).match("key-foo")); + ScanIterator scan = ScanIterator.hscanNovalues(redis, "none", ScanArgs.Builder.limit(50).match("key-foo")); assertThat(scan.hasNext()).isFalse(); try { @@ -185,8 +185,7 @@ void hashNovaluesSinglePass() { redis.hmset(key, KeysAndValues.MAP); - ScanIterator scan = ScanIterator.hscanNovalues(redis, key, - ScanArgs.Builder.limit(50).match("key-11*")); + ScanIterator scan = ScanIterator.hscanNovalues(redis, key, ScanArgs.Builder.limit(50).match("key-11*")); for (int i = 0; i < 11; i++) { assertThat(scan.hasNext()).isTrue(); @@ -322,4 +321,5 @@ void zsetMultiPass() { assertThat(values).containsAll(values); } + } diff --git a/src/test/java/io/lettuce/core/cluster/ScanStreamIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/ScanStreamIntegrationTests.java index 090a36f63b..621ddb1b19 100644 --- a/src/test/java/io/lettuce/core/cluster/ScanStreamIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/ScanStreamIntegrationTests.java @@ -21,6 +21,7 @@ class ScanStreamIntegrationTests extends TestSupport { private final StatefulRedisClusterConnection connection; + private final RedisClusterCommands redis; @Inject @@ -43,4 +44,5 @@ void shouldScanIteratively() { .verifyComplete(); StepVerifier.create(ScanStream.scan(reactive)).expectNextCount(1000).verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/SingleThreadedReactiveClusterClientIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/SingleThreadedReactiveClusterClientIntegrationTests.java index cd0afa6bae..fcf4fdbbd7 100644 --- a/src/test/java/io/lettuce/core/cluster/SingleThreadedReactiveClusterClientIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/SingleThreadedReactiveClusterClientIntegrationTests.java @@ -55,4 +55,5 @@ void shouldPropagateAsynchronousConnections() { assertThat(keys).contains("key", "foo"); } + } diff --git a/src/test/java/io/lettuce/core/cluster/SlotHashUnitTests.java b/src/test/java/io/lettuce/core/cluster/SlotHashUnitTests.java index d65e166ab2..b7b26c029a 100644 --- a/src/test/java/io/lettuce/core/cluster/SlotHashUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/SlotHashUnitTests.java @@ -13,6 +13,7 @@ class SlotHashUnitTests { private static final byte[] BYTES = "123456789".getBytes(); + private static final byte[] TAGGED = "key{123456789}a".getBytes(); @Test @@ -42,4 +43,5 @@ void testHashWithHash() { int result = SlotHash.getSlot((ByteBuffer) ByteBuffer.allocateDirect(TAGGED.length).put(TAGGED).flip()); assertThat(result).isEqualTo(0x31C3); } + } diff --git a/src/test/java/io/lettuce/core/cluster/commands/ListClusterCommandIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/commands/ListClusterCommandIntegrationTests.java index 9da426849e..145278a491 100644 --- a/src/test/java/io/lettuce/core/cluster/commands/ListClusterCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/commands/ListClusterCommandIntegrationTests.java @@ -27,7 +27,6 @@ class ListClusterCommandIntegrationTests extends ListCommandIntegrationTests { this.redis = connection.sync(); } - // re-implementation because keys have to be on the same slot @Test void brpoplpush() { @@ -39,7 +38,6 @@ void brpoplpush() { assertThat(redis.lrange("br7EPz9bbj", 0, -1)).isEqualTo(list("2", "3", "4")); } - @Test void brpoplpushTimeout() { assertThat(redis.brpoplpush(1, "UKPDHs8Zlp", "br7EPz9bbj")).isNull(); @@ -90,4 +88,5 @@ void rpoplpush() { assertThat(redis.lrange("UKPDHs8Zlp", 0, -1)).isEqualTo(list("1")); assertThat(redis.lrange("br7EPz9bbj", 0, -1)).isEqualTo(list("2", "3", "4")); } + } diff --git a/src/test/java/io/lettuce/core/cluster/commands/reactive/HashClusterReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/commands/reactive/HashClusterReactiveCommandIntegrationTests.java index b1040875a9..6da2e608d0 100644 --- a/src/test/java/io/lettuce/core/cluster/commands/reactive/HashClusterReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/commands/reactive/HashClusterReactiveCommandIntegrationTests.java @@ -30,4 +30,5 @@ public void hgetall() { public void hgetallStreaming() { } + } diff --git a/src/test/java/io/lettuce/core/cluster/commands/reactive/StringClusterReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/commands/reactive/StringClusterReactiveCommandIntegrationTests.java index 492c1070ae..651bd529b2 100644 --- a/src/test/java/io/lettuce/core/cluster/commands/reactive/StringClusterReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/commands/reactive/StringClusterReactiveCommandIntegrationTests.java @@ -24,6 +24,7 @@ class StringClusterReactiveCommandIntegrationTests extends StringCommandIntegrationTests { private final StatefulRedisClusterConnection connection; + private final RedisClusterCommands redis; @Inject @@ -58,4 +59,5 @@ void mget() { Flux> mget = reactive.mget(key, "key1", "key2"); StepVerifier.create(mget.next()).expectNext(KeyValue.just(key, value)).verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java b/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java index fa694b9c2d..4c0d02fc53 100644 --- a/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/models/partitions/RedisClusterNodeUnitTests.java @@ -54,4 +54,5 @@ void testToString() { assertThat(node.toString()).contains(RedisClusterNode.class.getSimpleName()); } + } diff --git a/src/test/java/io/lettuce/core/cluster/models/slots/ClusterSlotsParserUnitTests.java b/src/test/java/io/lettuce/core/cluster/models/slots/ClusterSlotsParserUnitTests.java index a67ec113fe..9a47ad0894 100644 --- a/src/test/java/io/lettuce/core/cluster/models/slots/ClusterSlotsParserUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/models/slots/ClusterSlotsParserUnitTests.java @@ -116,4 +116,5 @@ void testModel() { assertThat(range.toString()).contains(ClusterSlotRange.class.getSimpleName()); } + } diff --git a/src/test/java/io/lettuce/core/cluster/topology/RequestsUnitTests.java b/src/test/java/io/lettuce/core/cluster/topology/RequestsUnitTests.java index 5a96533a3e..fcf3f0e8dd 100644 --- a/src/test/java/io/lettuce/core/cluster/topology/RequestsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/topology/RequestsUnitTests.java @@ -86,4 +86,5 @@ private TimedAsyncCommand getCommand(String response) { timedAsyncCommand.complete(); return timedAsyncCommand; } + } diff --git a/src/test/java/io/lettuce/core/cluster/topology/TopologyComparatorsUnitTests.java b/src/test/java/io/lettuce/core/cluster/topology/TopologyComparatorsUnitTests.java index c1a69cefa1..5e027077d7 100644 --- a/src/test/java/io/lettuce/core/cluster/topology/TopologyComparatorsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/topology/TopologyComparatorsUnitTests.java @@ -43,7 +43,9 @@ class TopologyComparatorsUnitTests { private RedisClusterNodeSnapshot node1 = createNode("1"); + private RedisClusterNodeSnapshot node2 = createNode("2"); + private RedisClusterNodeSnapshot node3 = createNode("3"); private static RedisClusterNodeSnapshot createNode(String nodeId) { @@ -367,4 +369,5 @@ void runTest(Map map, List expectation, assertThat(result).containsExactly(expectation.toArray(new RedisClusterNodeSnapshot[expectation.size()])); } + } diff --git a/src/test/java/io/lettuce/core/codec/CipherCodecUnitTests.java b/src/test/java/io/lettuce/core/codec/CipherCodecUnitTests.java index a05bdc6392..c6f8c1e654 100644 --- a/src/test/java/io/lettuce/core/codec/CipherCodecUnitTests.java +++ b/src/test/java/io/lettuce/core/codec/CipherCodecUnitTests.java @@ -30,10 +30,13 @@ class CipherCodecUnitTests { private final SecretKeySpec key = new SecretKeySpec("1234567890123456".getBytes(), "AES"); + private final IvParameterSpec iv = new IvParameterSpec("1234567890123456".getBytes()); + private final String transform = "AES/CBC/PKCS5Padding"; CipherCodec.CipherSupplier encrypt = new CipherCodec.CipherSupplier() { + @Override public Cipher get(CipherCodec.KeyDescriptor keyDescriptor) throws GeneralSecurityException { @@ -46,6 +49,7 @@ public Cipher get(CipherCodec.KeyDescriptor keyDescriptor) throws GeneralSecurit public CipherCodec.KeyDescriptor encryptionKey() { return CipherCodec.KeyDescriptor.create("foobar", 142); } + }; CipherCodec.CipherSupplier decrypt = (CipherCodec.KeyDescriptor keyDescriptor) -> { @@ -106,8 +110,8 @@ void shouldDecryptValue() { RedisCodec crypto = CipherCodec.forValues(StringCodec.UTF8, encrypt, decrypt); - ByteBuffer encrypted = ByteBuffer.wrap(new byte[] { 36, 43, 48, 36, -99, -39, 126, -106, -7, -88, 118, -74, 42, 98, - 117, 81, 37, -124, 26, -88 });// crypto.encodeValue("foobar"); + ByteBuffer encrypted = ByteBuffer.wrap( + new byte[] { 36, 43, 48, 36, -99, -39, 126, -106, -7, -88, 118, -74, 42, 98, 117, 81, 37, -124, 26, -88 });// crypto.encodeValue("foobar"); String result = crypto.decodeValue(encrypted); assertThat(result).isEqualTo("foobar"); @@ -123,6 +127,7 @@ void shouldRejectPlusAndDollarKeyNames() { static class CryptoTestArgs { private final int size; + private final String content; public CryptoTestArgs(String content) { @@ -138,5 +143,7 @@ public String toString() { sb.append(']'); return sb.toString(); } + } + } diff --git a/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java b/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java index 1dc1f1213a..0351d9a51a 100644 --- a/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java +++ b/src/test/java/io/lettuce/core/codec/CompressionCodecUnitTests.java @@ -15,9 +15,12 @@ class CompressionCodecUnitTests { private String key = "key"; + private byte[] keyGzipBytes = new byte[] { 31, -117, 8, 0, 0, 0, 0, 0, 0, 0, -53, 78, -83, 4, 0, -87, -85, -112, -118, 3, 0, 0, 0 }; + private byte[] keyDeflateBytes = new byte[] { 120, -100, -53, 78, -83, 4, 0, 2, -121, 1, 74 }; + private String value = "value"; @Test @@ -56,8 +59,7 @@ void wrongCompressionTypeOnDecode() { RedisCodec sut = CompressionCodec.valueCompressor(StringCodec.UTF8, CompressionCodec.CompressionType.DEFLATE); - assertThatThrownBy(() -> sut.decodeValue(ByteBuffer.wrap(keyGzipBytes))) - .isInstanceOf(IllegalStateException.class); + assertThatThrownBy(() -> sut.decodeValue(ByteBuffer.wrap(keyGzipBytes))).isInstanceOf(IllegalStateException.class); } private String toString(ByteBuffer buffer) { @@ -70,4 +72,5 @@ private byte[] toBytes(ByteBuffer buffer) { buffer.get(bytes); return bytes; } + } diff --git a/src/test/java/io/lettuce/core/codec/StringCodecUnitTests.java b/src/test/java/io/lettuce/core/codec/StringCodecUnitTests.java index 0b41407131..8dfdd1ca56 100644 --- a/src/test/java/io/lettuce/core/codec/StringCodecUnitTests.java +++ b/src/test/java/io/lettuce/core/codec/StringCodecUnitTests.java @@ -39,6 +39,7 @@ class StringCodecUnitTests { private String teststring = "hello üäü~∑†®†ª€∂‚¶¢ Wørld"; + private String teststringPlain = "hello uufadsfasdfadssdfadfs"; @Test @@ -129,10 +130,9 @@ void estimateSize() { void sizeOf() { assertThat(new StringCodec(StandardCharsets.UTF_8).sizeOf(teststring, false)) - .isEqualTo(ByteBufUtil.utf8MaxBytes(teststring)); - assertThat(new StringCodec(StandardCharsets.US_ASCII).sizeOf(teststring, false)) - .isEqualTo(teststring.length()); - assertThat(new StringCodec(StandardCharsets.ISO_8859_1).sizeOf(teststring, false)) - .isEqualTo(teststring.length()); + .isEqualTo(ByteBufUtil.utf8MaxBytes(teststring)); + assertThat(new StringCodec(StandardCharsets.US_ASCII).sizeOf(teststring, false)).isEqualTo(teststring.length()); + assertThat(new StringCodec(StandardCharsets.ISO_8859_1).sizeOf(teststring, false)).isEqualTo(teststring.length()); } + } diff --git a/src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java index 4ecd8d0c40..2752bc813c 100644 --- a/src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/BitCommandIntegrationTests.java @@ -53,6 +53,7 @@ public class BitCommandIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisCommands redis; protected RedisCommands bitstring; diff --git a/src/test/java/io/lettuce/core/commands/BitStringCodec.java b/src/test/java/io/lettuce/core/commands/BitStringCodec.java index 002f96e088..e1f7b2cab2 100644 --- a/src/test/java/io/lettuce/core/commands/BitStringCodec.java +++ b/src/test/java/io/lettuce/core/commands/BitStringCodec.java @@ -20,4 +20,5 @@ public String decodeValue(ByteBuffer bytes) { } return bits.toString(); } + } diff --git a/src/test/java/io/lettuce/core/commands/CustomCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/CustomCommandIntegrationTests.java index dac8934922..ceb49722e2 100644 --- a/src/test/java/io/lettuce/core/commands/CustomCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/CustomCommandIntegrationTests.java @@ -72,8 +72,8 @@ void setUp() { @Test void dispatchSet() { - String response = redis.dispatch(MyCommands.SET, new StatusOutput<>(StringCodec.UTF8), new CommandArgs<>( - StringCodec.UTF8).addKey(key).addValue(value)); + String response = redis.dispatch(MyCommands.SET, new StatusOutput<>(StringCodec.UTF8), + new CommandArgs<>(StringCodec.UTF8).addKey(key).addValue(value)); assertThat(response).isEqualTo("OK"); } @@ -106,17 +106,16 @@ void dispatchNoOutputButError() { void dispatchShouldFailForWrongDataType() { redis.hset(key, key, value); - assertThatThrownBy( - () -> redis.dispatch(CommandType.GET, new StatusOutput<>(StringCodec.UTF8), - new CommandArgs<>(StringCodec.UTF8).addKey(key))).isInstanceOf(RedisCommandExecutionException.class); + assertThatThrownBy(() -> redis.dispatch(CommandType.GET, new StatusOutput<>(StringCodec.UTF8), + new CommandArgs<>(StringCodec.UTF8).addKey(key))).isInstanceOf(RedisCommandExecutionException.class); } @Test void dispatchTransactions() { redis.multi(); - String response = redis.dispatch(CommandType.SET, new StatusOutput<>(StringCodec.UTF8), new CommandArgs<>( - StringCodec.UTF8).addKey(key).addValue(value)); + String response = redis.dispatch(CommandType.SET, new StatusOutput<>(StringCodec.UTF8), + new CommandArgs<>(StringCodec.UTF8).addKey(key).addValue(value)); TransactionResult exec = redis.exec(); @@ -201,6 +200,7 @@ private StatefulRedisConnection getStandaloneConnection() { } public enum MyCommands implements ProtocolKeyword { + PING, SET, INFO; private final byte name[]; @@ -214,5 +214,7 @@ public enum MyCommands implements ProtocolKeyword { public byte[] getBytes() { return name; } + } + } diff --git a/src/test/java/io/lettuce/core/commands/HLLCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/HLLCommandIntegrationTests.java index 5adcab1a97..7749a2fd50 100644 --- a/src/test/java/io/lettuce/core/commands/HLLCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/HLLCommandIntegrationTests.java @@ -106,4 +106,5 @@ void pfaddPfmergePfCount() { assertThat(redis.pfcount("key8885")).isEqualTo(3); } + } diff --git a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java index b87102505d..e6431f97a7 100644 --- a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java @@ -63,8 +63,11 @@ @ExtendWith(LettuceExtension.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class HashCommandIntegrationTests extends TestSupport { + public static final String MY_KEY = "hKey"; + public static final String MY_FIELD = "hField"; + public static final String MY_VALUE = "hValue"; private final RedisCommands redis; @@ -82,8 +85,8 @@ void setUp() { @AfterEach void tearDown() { // resets the configuration settings to default, would not be needed once listpack is supported - assertThat(redis.configSet("hash-max-listpack-entries","512")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","64")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "512")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "64")).isEqualTo("OK"); } @Test @@ -561,8 +564,8 @@ void hscanNoValuesMatch() { void hexpire() { // the below settings are required until the solution is able to support listpack entries // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).isTrue(); @@ -575,8 +578,8 @@ void hexpire() { void hexpireExpireArgs() { // the below settings are required until the solution is able to support listpack entries // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.nx(), MY_FIELD)).isTrue(); @@ -592,11 +595,11 @@ void hexpireExpireArgs() { void hexpireat() { // the below settings are required until the solution is able to support listpack entries // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hexpireat(MY_KEY,Instant.now().plusSeconds(1) , MY_FIELD)).isTrue(); + assertThat(redis.hexpireat(MY_KEY, Instant.now().plusSeconds(1), MY_FIELD)).isTrue(); await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); } @@ -607,8 +610,8 @@ void hexpiretime() { Date expiration = new Date(System.currentTimeMillis() + 10000); // the below settings are required until the solution is able to support listpack entries // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); assertThat(redis.hexpireat(MY_KEY, expiration, MY_FIELD)).isTrue(); @@ -621,8 +624,8 @@ void hexpiretime() { void persist() { // the below settings are required until the solution is able to support listpack entries // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries","0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value","0")).isEqualTo("OK"); + assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); + assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isFalse(); assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); @@ -638,4 +641,5 @@ void setup100KeyValues(Map expect) { redis.hmset(key, expect); } + } diff --git a/src/test/java/io/lettuce/core/commands/NumericCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/NumericCommandIntegrationTests.java index 0bf5779e0c..6a2a7c1000 100644 --- a/src/test/java/io/lettuce/core/commands/NumericCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/NumericCommandIntegrationTests.java @@ -83,4 +83,5 @@ void incrbyfloat() { assertThat(redis.incrbyfloat(key, 3.0)).isEqualTo(3.0, offset(0.1)); assertThat(redis.incrbyfloat(key, 0.2)).isEqualTo(3.2, offset(0.1)); } + } diff --git a/src/test/java/io/lettuce/core/commands/RunOnlyOnceServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/RunOnlyOnceServerCommandIntegrationTests.java index bf158e033e..25d75291de 100644 --- a/src/test/java/io/lettuce/core/commands/RunOnlyOnceServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/RunOnlyOnceServerCommandIntegrationTests.java @@ -32,7 +32,9 @@ class RunOnlyOnceServerCommandIntegrationTests extends TestSupport { private final RedisClient client; + private final StatefulRedisConnection connection; + private final RedisCommands redis; @Inject @@ -94,8 +96,8 @@ void migrateCopyReplace() { String result = redis.migrate("localhost", TestSettings.port(2), 0, 10, MigrateArgs.Builder.keys(key).copy().replace()); assertThat(result).isEqualTo("OK"); - result = redis.migrate("localhost", TestSettings.port(2), 0, 10, MigrateArgs.Builder - .keys(Arrays.asList("key1", "key2")).replace()); + result = redis.migrate("localhost", TestSettings.port(2), 0, 10, + MigrateArgs.Builder.keys(Arrays.asList("key1", "key2")).replace()); assertThat(result).isEqualTo("OK"); } @@ -122,4 +124,5 @@ void shutdown() { commands.getStatefulConnection().close(); } } + } diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index ebdfa61ad1..b10517dfd9 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -210,7 +210,7 @@ void clientListExtended() { } @Test - @EnabledOnCommand("EVAL_RO") // Redis 7.0 + @EnabledOnCommand("EVAL_RO") // Redis 7.0 void clientNoEvict() { assertThat(redis.clientNoEvict(true)).isEqualTo("OK"); assertThat(redis.clientNoEvict(false)).isEqualTo("OK"); @@ -340,7 +340,7 @@ void configGet() { } @Test - @EnabledOnCommand("EVAL_RO") // Redis 7.0 + @EnabledOnCommand("EVAL_RO") // Redis 7.0 void configGetMultipleParameters() { assertThat(redis.configGet("maxmemory", "*max-*-entries*")).containsEntry("maxmemory", "0") .containsEntry("hash-max-listpack-entries", "512"); @@ -363,7 +363,7 @@ void configSet() { } @Test - @EnabledOnCommand("EVAL_RO") // Redis 7.0 + @EnabledOnCommand("EVAL_RO") // Redis 7.0 void configSetMultipleParameters() { Map original = redis.configGet("maxmemory", "hash-max-listpack-entries"); Map config = new HashMap<>(); diff --git a/src/test/java/io/lettuce/core/commands/SetCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/SetCommandIntegrationTests.java index 413b9f3b66..9f0d579eac 100644 --- a/src/test/java/io/lettuce/core/commands/SetCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/SetCommandIntegrationTests.java @@ -241,7 +241,7 @@ void sremEmpty() { @Test void sremNulls() { - assertThatThrownBy(() -> redis.srem(key, new String[0])).isInstanceOf(IllegalArgumentException. class); + assertThatThrownBy(() -> redis.srem(key, new String[0])).isInstanceOf(IllegalArgumentException.class); } @Test @@ -252,7 +252,7 @@ void sunion() { @Test void sunionEmpty() { - assertThatThrownBy(() -> redis.sunion()).isInstanceOf(IllegalArgumentException. class); + assertThatThrownBy(() -> redis.sunion()).isInstanceOf(IllegalArgumentException.class); } @Test diff --git a/src/test/java/io/lettuce/core/commands/StringCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/StringCommandIntegrationTests.java index 95539e5e5d..0bee9425fd 100644 --- a/src/test/java/io/lettuce/core/commands/StringCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/StringCommandIntegrationTests.java @@ -230,12 +230,12 @@ void setKeepTTL() { @Test void setNegativeEX() { - assertThatThrownBy(() -> redis.set(key, value, ex(-10))).isInstanceOf(RedisException. class); + assertThatThrownBy(() -> redis.set(key, value, ex(-10))).isInstanceOf(RedisException.class); } @Test void setNegativePX() { - assertThatThrownBy(() -> redis.set(key, value, px(-1000))).isInstanceOf(RedisException. class); + assertThatThrownBy(() -> redis.set(key, value, px(-1000))).isInstanceOf(RedisException.class); } @Test @@ -309,13 +309,11 @@ void time() { @EnabledOnCommand("STRALGO") void strAlgo() { - StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder - .strings("ohmytext", "mynewtext")); + StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder.strings("ohmytext", "mynewtext")); assertThat(matchResult.getMatchString()).isEqualTo("mytext"); // STRALGO LCS STRINGS a b - matchResult = redis.stralgoLcs(StrAlgoArgs.Builder - .strings("a", "b").minMatchLen(4).withIdx().withMatchLen()); + matchResult = redis.stralgoLcs(StrAlgoArgs.Builder.strings("a", "b").minMatchLen(4).withIdx().withMatchLen()); assertThat(matchResult.getMatchString()).isNullOrEmpty(); assertThat(matchResult.getLen()).isEqualTo(0); } @@ -340,8 +338,7 @@ void strAlgoUsingKeys() { @EnabledOnCommand("STRALGO") void strAlgoJustLen() { - StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder - .strings("ohmytext", "mynewtext").justLen()); + StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder.strings("ohmytext", "mynewtext").justLen()); assertThat(matchResult.getLen()).isEqualTo(6); } @@ -350,8 +347,7 @@ void strAlgoJustLen() { @EnabledOnCommand("STRALGO") void strAlgoWithMinMatchLen() { - StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder - .strings("ohmytext", "mynewtext").minMatchLen(4)); + StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder.strings("ohmytext", "mynewtext").minMatchLen(4)); assertThat(matchResult.getMatchString()).isEqualTo("mytext"); } @@ -361,8 +357,8 @@ void strAlgoWithMinMatchLen() { void strAlgoWithIdx() { // STRALGO LCS STRINGS ohmytext mynewtext IDX MINMATCHLEN 4 WITHMATCHLEN - StringMatchResult matchResult = redis.stralgoLcs(StrAlgoArgs.Builder - .strings("ohmytext", "mynewtext").minMatchLen(4).withIdx().withMatchLen()); + StringMatchResult matchResult = redis + .stralgoLcs(StrAlgoArgs.Builder.strings("ohmytext", "mynewtext").minMatchLen(4).withIdx().withMatchLen()); assertThat(matchResult.getMatches()).hasSize(1); assertThat(matchResult.getMatches().get(0).getMatchLen()).isEqualTo(4); @@ -376,4 +372,5 @@ void strAlgoWithIdx() { assertThat(b.getEnd()).isEqualTo(8); assertThat(matchResult.getLen()).isEqualTo(6); } + } diff --git a/src/test/java/io/lettuce/core/commands/TransactionCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/TransactionCommandIntegrationTests.java index fc74c044d2..df8d6adf86 100644 --- a/src/test/java/io/lettuce/core/commands/TransactionCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/TransactionCommandIntegrationTests.java @@ -42,6 +42,7 @@ public class TransactionCommandIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisCommands redis; @Inject @@ -140,16 +141,17 @@ void errorInMulti() { @Test void execWithoutMulti() { - assertThatThrownBy(redis::exec).isInstanceOf(RedisCommandExecutionException.class).hasMessageContaining( - "ERR EXEC without MULTI"); + assertThatThrownBy(redis::exec).isInstanceOf(RedisCommandExecutionException.class) + .hasMessageContaining("ERR EXEC without MULTI"); } @Test void multiCalledTwiceShouldFail() { redis.multi(); - assertThatThrownBy(redis::multi).isInstanceOf(RedisCommandExecutionException.class).hasMessageContaining( - "ERR MULTI calls can not be nested"); + assertThatThrownBy(redis::multi).isInstanceOf(RedisCommandExecutionException.class) + .hasMessageContaining("ERR MULTI calls can not be nested"); redis.discard(); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/BitReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/BitReactiveCommandIntegrationTests.java index 57ebd996b1..ed5c30f36d 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/BitReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/BitReactiveCommandIntegrationTests.java @@ -90,10 +90,11 @@ void bitfieldIncrBy() { @Test void bitfieldOverflow() { - BitFieldArgs bitFieldArgs = BitFieldArgs.Builder.overflow(FAIL).set(signed(8), 9, 5) - .incrBy(signed(8), Integer.MAX_VALUE); + BitFieldArgs bitFieldArgs = BitFieldArgs.Builder.overflow(FAIL).set(signed(8), 9, 5).incrBy(signed(8), + Integer.MAX_VALUE); StepVerifier.create(reactive.bitfield(key, bitFieldArgs)).expectNext(Value.just(0L)).expectNext(Value.empty()) .verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/CustomReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/CustomReactiveCommandIntegrationTests.java index 81a678156f..6e82d20391 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/CustomReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/CustomReactiveCommandIntegrationTests.java @@ -38,8 +38,8 @@ void dispatchGetAndSet() { redis.set(key, value); RedisReactiveCommands reactive = redis.getStatefulConnection().reactive(); - Flux flux = reactive.dispatch(CommandType.GET, new ValueOutput<>(StringCodec.UTF8), new CommandArgs<>( - StringCodec.UTF8).addKey(key)); + Flux flux = reactive.dispatch(CommandType.GET, new ValueOutput<>(StringCodec.UTF8), + new CommandArgs<>(StringCodec.UTF8).addKey(key)); StepVerifier.create(flux).expectNext(value).verifyComplete(); } @@ -50,9 +50,10 @@ void dispatchList() { redis.rpush(key, "a", "b", "c"); RedisReactiveCommands reactive = redis.getStatefulConnection().reactive(); - Flux flux = reactive.dispatch(CommandType.LRANGE, new ValueListOutput<>(StringCodec.UTF8), new CommandArgs<>( - StringCodec.UTF8).addKey(key).add(0).add(-1)); + Flux flux = reactive.dispatch(CommandType.LRANGE, new ValueListOutput<>(StringCodec.UTF8), + new CommandArgs<>(StringCodec.UTF8).addKey(key).add(0).add(-1)); StepVerifier.create(flux).expectNext("a", "b", "c").verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/GeoReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/GeoReactiveCommandIntegrationTests.java index 757d53604e..da0975c0b2 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/GeoReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/GeoReactiveCommandIntegrationTests.java @@ -50,4 +50,5 @@ public void geopos() { @Override public void geoposInTransaction() { } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/HLLReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/HLLReactiveCommandIntegrationTests.java index 7587539885..fe4d90d746 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/HLLReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/HLLReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class HLLReactiveCommandIntegrationTests extends HLLCommandIntegrationTests { HLLReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/HashReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/HashReactiveCommandIntegrationTests.java index 458fb5c384..cca4947dca 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/HashReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/HashReactiveCommandIntegrationTests.java @@ -48,4 +48,5 @@ public void hgetall() { public void hgetallStreaming() { } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/KeyReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/KeyReactiveCommandIntegrationTests.java index 3343e6a69c..134f4ce1a6 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/KeyReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/KeyReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class KeyReactiveCommandIntegrationTests extends KeyCommandIntegrationTests { KeyReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/ListReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/ListReactiveCommandIntegrationTests.java index ca322ad8d3..58e4f43d35 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/ListReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/ListReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class ListReactiveCommandIntegrationTests extends ListCommandIntegrationTests { ListReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/NumericReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/NumericReactiveCommandIntegrationTests.java index 4e8971a188..39a0fb78e1 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/NumericReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/NumericReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class NumericReactiveCommandIntegrationTests extends NumericCommandIntegrationTe NumericReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/ScriptingReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/ScriptingReactiveCommandIntegrationTests.java index d9257066e6..fcd5a574d4 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/ScriptingReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/ScriptingReactiveCommandIntegrationTests.java @@ -16,4 +16,5 @@ class ScriptingReactiveCommandIntegrationTests extends ScriptingCommandIntegrati ScriptingReactiveCommandIntegrationTests(RedisClient client, StatefulRedisConnection connection) { super(client, ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/SetReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/SetReactiveCommandIntegrationTests.java index 85c383800a..8bef010797 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/SetReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/SetReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class SetReactiveCommandIntegrationTests extends SetCommandIntegrationTests { SetReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/SortReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/SortReactiveCommandIntegrationTests.java index 88a3fb21a1..6e7bcc95e6 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/SortReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/SortReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class SortReactiveCommandIntegrationTests extends SortCommandIntegrationTests { SortReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/SortedSetReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/SortedSetReactiveCommandIntegrationTests.java index b2deb0e28b..71ab51524a 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/SortedSetReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/SortedSetReactiveCommandIntegrationTests.java @@ -41,4 +41,5 @@ public void zmscore() { assertThat(actual).isEqualTo(list(1.0, null, 2.0)); }).verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/StreamReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/StreamReactiveCommandIntegrationTests.java index 7491eae769..218bd4e412 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/StreamReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/StreamReactiveCommandIntegrationTests.java @@ -15,4 +15,5 @@ class StreamReactiveCommandIntegrationTests extends StreamCommandIntegrationTest StreamReactiveCommandIntegrationTests(StatefulRedisConnection connection) { super(ReactiveSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/reactive/StringReactiveCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/reactive/StringReactiveCommandIntegrationTests.java index 889eb156a2..ea81cebd85 100644 --- a/src/test/java/io/lettuce/core/commands/reactive/StringReactiveCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/reactive/StringReactiveCommandIntegrationTests.java @@ -19,6 +19,7 @@ class StringReactiveCommandIntegrationTests extends StringCommandIntegrationTests { private final RedisCommands redis; + private final RedisReactiveCommands reactive; @Inject @@ -47,4 +48,5 @@ void mgetEmpty() { Flux> mget = reactive.mget("unknown"); StepVerifier.create(mget.next()).expectNext(KeyValue.empty("unknown")).verifyComplete(); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/BitTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/BitTxCommandIntegrationTests.java index b1156d8f27..9cdbb9f1e7 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/BitTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/BitTxCommandIntegrationTests.java @@ -15,4 +15,5 @@ class BitTxCommandIntegrationTests extends BitCommandIntegrationTests { BitTxCommandIntegrationTests(RedisClient client, StatefulRedisConnection connection) { super(client, TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/GeoTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/GeoTxCommandIntegrationTests.java index 5566adc511..8d2f19c08d 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/GeoTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/GeoTxCommandIntegrationTests.java @@ -56,4 +56,5 @@ public void geodistInTransaction() { @Override public void geohashInTransaction() { } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/HLLTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/HLLTxCommandIntegrationTests.java index ca67fc4d7a..c3707fe685 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/HLLTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/HLLTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class HLLTxCommandIntegrationTests extends HLLCommandIntegrationTests { HLLTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/HashTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/HashTxCommandIntegrationTests.java index de8d21a4a0..12965fd2c3 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/HashTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/HashTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class HashTxCommandIntegrationTests extends HashCommandIntegrationTests { HashTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/KeyTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/KeyTxCommandIntegrationTests.java index 4b9c2620de..cc9e298302 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/KeyTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/KeyTxCommandIntegrationTests.java @@ -21,4 +21,5 @@ public class KeyTxCommandIntegrationTests extends KeyCommandIntegrationTests { @Override public void move() { } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/ListTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/ListTxCommandIntegrationTests.java index e57f86e2e6..b86291b0f6 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/ListTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/ListTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class ListTxCommandIntegrationTests extends ListCommandIntegrationTests { ListTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/SetTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/SetTxCommandIntegrationTests.java index ed1053b662..47714e0b87 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/SetTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/SetTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class SetTxCommandIntegrationTests extends SetCommandIntegrationTests { SetTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/SortTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/SortTxCommandIntegrationTests.java index fc2f2d9ca7..8813b5e34f 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/SortTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/SortTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class SortTxCommandIntegrationTests extends SortCommandIntegrationTests { SortTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/SortedSetTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/SortedSetTxCommandIntegrationTests.java index ccbe2c9b59..3d443f6a1e 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/SortedSetTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/SortedSetTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class SortedSetTxCommandIntegrationTests extends SortedSetCommandIntegrationTest SortedSetTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/StringTxCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/transactional/StringTxCommandIntegrationTests.java index 4a033970e3..46e388460e 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/StringTxCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/transactional/StringTxCommandIntegrationTests.java @@ -14,4 +14,5 @@ class StringTxCommandIntegrationTests extends StringCommandIntegrationTests { StringTxCommandIntegrationTests(StatefulRedisConnection connection) { super(TxSyncInvocationHandler.sync(connection)); } + } diff --git a/src/test/java/io/lettuce/core/commands/transactional/TxSyncInvocationHandler.java b/src/test/java/io/lettuce/core/commands/transactional/TxSyncInvocationHandler.java index 7898941960..4cffd56cb8 100644 --- a/src/test/java/io/lettuce/core/commands/transactional/TxSyncInvocationHandler.java +++ b/src/test/java/io/lettuce/core/commands/transactional/TxSyncInvocationHandler.java @@ -18,9 +18,13 @@ class TxSyncInvocationHandler extends AbstractInvocationHandler { private final Object api; + private final Method multi; + private final Method discard; + private final Method exec; + private final Method ping; private TxSyncInvocationHandler(Object api) throws Exception { @@ -100,4 +104,5 @@ public static RedisCommands sync(StatefulRedisConnection conn throw new IllegalStateException(e); } } + } diff --git a/src/test/java/io/lettuce/core/dynamic/BatchExecutableCommandLookupStrategyUnitTests.java b/src/test/java/io/lettuce/core/dynamic/BatchExecutableCommandLookupStrategyUnitTests.java index 68c11d5bed..7163785b42 100644 --- a/src/test/java/io/lettuce/core/dynamic/BatchExecutableCommandLookupStrategyUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/BatchExecutableCommandLookupStrategyUnitTests.java @@ -30,6 +30,7 @@ class BatchExecutableCommandLookupStrategyUnitTests { @Mock private RedisCommandsMetadata metadata; + @Mock private StatefulRedisConnection connection; @@ -73,8 +74,8 @@ void shouldNotAllowTimeoutParameter() { @Test void shouldNotAllowSynchronousReturnTypes() { - assertThatThrownBy(() -> sut.resolveCommandMethod(getMethod("withReturnType"), metadata)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> sut.resolveCommandMethod(getMethod("withReturnType"), metadata)) + .isInstanceOf(IllegalArgumentException.class); } private CommandMethod getMethod(String name, Class... parameterTypes) throws NoSuchMethodException { @@ -90,5 +91,7 @@ private static interface BatchingCommands { String withReturnType(); void justVoid(); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/CommandSegmentCommandFactoryUnitTests.java b/src/test/java/io/lettuce/core/dynamic/CommandSegmentCommandFactoryUnitTests.java index 38dce41b95..1b962d1f7b 100644 --- a/src/test/java/io/lettuce/core/dynamic/CommandSegmentCommandFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/CommandSegmentCommandFactoryUnitTests.java @@ -188,6 +188,7 @@ private interface Commands { @Command("XYZ") boolean unknownCommand(); + } private static interface MethodsWithTimeout { @@ -195,5 +196,7 @@ private static interface MethodsWithTimeout { Future async(String key, Timeout timeout); String sync(String key, Timeout timeout); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/ConversionServiceUnitTests.java b/src/test/java/io/lettuce/core/dynamic/ConversionServiceUnitTests.java index cf35802afa..3a684a5882 100644 --- a/src/test/java/io/lettuce/core/dynamic/ConversionServiceUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/ConversionServiceUnitTests.java @@ -56,17 +56,21 @@ void convert() { } private class FluxToObservableConverter implements Function, Observable> { + @Override public Observable apply(Flux source) { return null; } + } private class MonoToObservableConverter implements Function, Observable> { + @Override public Observable apply(Mono source) { return Observable.just("world"); } + } } diff --git a/src/test/java/io/lettuce/core/dynamic/DeclaredCommandMethodUnitTests.java b/src/test/java/io/lettuce/core/dynamic/DeclaredCommandMethodUnitTests.java index 22ab75580b..c60efd0973 100644 --- a/src/test/java/io/lettuce/core/dynamic/DeclaredCommandMethodUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/DeclaredCommandMethodUnitTests.java @@ -52,5 +52,7 @@ private interface MyInterface { Future getFuture(); Flux getFlux(); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/DefaultCommandMethodVerifierUnitTests.java b/src/test/java/io/lettuce/core/dynamic/DefaultCommandMethodVerifierUnitTests.java index 67d6303d54..8ad6f2e84d 100644 --- a/src/test/java/io/lettuce/core/dynamic/DefaultCommandMethodVerifierUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/DefaultCommandMethodVerifierUnitTests.java @@ -132,5 +132,7 @@ private static interface MyInterface { void lpop(@Param("key") String key); void rpop(String key1, String key2); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/ParameterBinderUnitTests.java b/src/test/java/io/lettuce/core/dynamic/ParameterBinderUnitTests.java index 776e409735..bb065be03e 100644 --- a/src/test/java/io/lettuce/core/dynamic/ParameterBinderUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/ParameterBinderUnitTests.java @@ -25,6 +25,7 @@ class ParameterBinderUnitTests { private ParameterBinder binder = new ParameterBinder(); + private CommandSegments segments = new CommandSegments(Collections.singletonList(CommandSegment.constant("set"))); @Test @@ -137,28 +138,27 @@ void rejectsStringUpperValue() { @Test void bindsValueRangeCorrectly() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(MyCommands.class, "valueRange", - Range.class)); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(MyCommands.class, "valueRange", Range.class)); CommandArgs args = bind(commandMethod, Range.from(Range.Boundary.including("lower"), Range.Boundary.excluding("upper"))); - assertThat(args.toCommandString()).isEqualTo( - String.format("%s %s", Base64.getEncoder().encodeToString("[lower".getBytes()), + assertThat(args.toCommandString()) + .isEqualTo(String.format("%s %s", Base64.getEncoder().encodeToString("[lower".getBytes()), Base64.getEncoder().encodeToString("(upper".getBytes()))); } @Test void bindsUnboundedValueRangeCorrectly() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(MyCommands.class, "valueRange", - Range.class)); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(MyCommands.class, "valueRange", Range.class)); CommandArgs args = bind(commandMethod, Range.unbounded()); - assertThat(args.toCommandString()).isEqualTo( - String.format("%s %s", Base64.getEncoder().encodeToString("-".getBytes()), - Base64.getEncoder().encodeToString("+".getBytes()))); + assertThat(args.toCommandString()).isEqualTo(String.format("%s %s", Base64.getEncoder().encodeToString("-".getBytes()), + Base64.getEncoder().encodeToString("+".getBytes()))); } @Test @@ -179,8 +179,7 @@ void bindsProtocolKeywordCorrectly() { private CommandArgs bind(Object object) { CommandMethod commandMethod = DeclaredCommandMethod - .create(ReflectionUtils.findMethod(MyCommands.class, "justObject", - Object.class)); + .create(ReflectionUtils.findMethod(MyCommands.class, "justObject", Object.class)); return bind(commandMethod, object); } @@ -199,5 +198,7 @@ private interface MyCommands { void justObject(Object object); void valueRange(@io.lettuce.core.dynamic.annotation.Value Range value); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/ReactiveCommandSegmentCommandFactoryUnitTests.java b/src/test/java/io/lettuce/core/dynamic/ReactiveCommandSegmentCommandFactoryUnitTests.java index 85266f8fe6..11bd196489 100644 --- a/src/test/java/io/lettuce/core/dynamic/ReactiveCommandSegmentCommandFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/ReactiveCommandSegmentCommandFactoryUnitTests.java @@ -81,5 +81,7 @@ private static interface ReactiveWithTimeout { Mono getOne(String key); Flux getMany(String key); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptersUnitTests.java b/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptersUnitTests.java index 8cefbc82e0..151d8ddbe4 100644 --- a/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptersUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptersUnitTests.java @@ -244,4 +244,5 @@ void toWrapperShouldConvertMonoToFlux() { Mono foo = Mono.just("foo"); assertThat(conversionService.convert(foo, Flux.class)).isInstanceOf(Flux.class); } + } diff --git a/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptionIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptionIntegrationTests.java index f1788c74a8..3bcb712b50 100644 --- a/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/ReactiveTypeAdaptionIntegrationTests.java @@ -25,7 +25,9 @@ class ReactiveTypeAdaptionIntegrationTests extends TestSupport { private final RedisCommands redis; private final RxJava1Types rxjava1; + private final RxJava2Types rxjava2; + private final RxJava3Types rxjava3; @Inject @@ -121,6 +123,7 @@ static interface RxJava1Types extends Commands { @Command("GET") Observable getRxJava1Observable(String key); + } static interface RxJava2Types extends Commands { @@ -136,6 +139,7 @@ static interface RxJava2Types extends Commands { @Command("GET") io.reactivex.Flowable getRxJava2Flowable(String key); + } static interface RxJava3Types extends Commands { @@ -151,5 +155,7 @@ static interface RxJava3Types extends Commands { @Command("GET") io.reactivex.rxjava3.core.Flowable getRxJava3Flowable(String key); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsAsyncIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsAsyncIntegrationTests.java index 087ebad012..df94daa623 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsAsyncIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsAsyncIntegrationTests.java @@ -40,6 +40,9 @@ void async() { } static interface MultipleExecutionModels extends Commands { + Future set(String key, String value); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsBatchingIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsBatchingIntegrationTests.java index ee36d8b237..b786eb62c5 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsBatchingIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsBatchingIntegrationTests.java @@ -218,6 +218,7 @@ static interface Batching extends Commands { @Command("LLEN") RedisFuture llenAsync(String key); + } static interface SelectiveBatching extends Commands, BatchExecutor { diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsClusterIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsClusterIntegrationTests.java index 90ce8e0a3f..d430f8b485 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsClusterIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsClusterIntegrationTests.java @@ -86,6 +86,7 @@ interface SynchronousCommands extends Commands { @Command("MGET") List> mgetAsValues(String... keys); + } } diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsIntegrationTests.java index aa5d1b7731..351989f03f 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsIntegrationTests.java @@ -34,6 +34,7 @@ class RedisCommandsIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisCommands redis; @Inject @@ -95,8 +96,8 @@ void verifierShouldCatchTooFewParametersDeclarations() { @Test void shouldWorkWithPooledConnection() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - client::connect, new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(client::connect, new GenericObjectPoolConfig<>()); try (StatefulRedisConnection connection = pool.borrowObject()) { @@ -126,14 +127,21 @@ void shouldWorkWithAsyncPooledConnection() { } private interface SimpleCommands extends Commands { + String get(String key); + } private interface TooFewParameters extends Commands { + String get(); + } private interface WithTypo extends Commands { + String gat(String key); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsReactiveIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsReactiveIntegrationTests.java index 2685b2ee6f..d394bb10bb 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsReactiveIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsReactiveIntegrationTests.java @@ -94,5 +94,7 @@ interface MultipleExecutionModels extends Commands { @Command("GET") Maybe getRxJava(String key); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/RedisCommandsSyncIntegrationTests.java b/src/test/java/io/lettuce/core/dynamic/RedisCommandsSyncIntegrationTests.java index 796deaeeb0..37181b0460 100644 --- a/src/test/java/io/lettuce/core/dynamic/RedisCommandsSyncIntegrationTests.java +++ b/src/test/java/io/lettuce/core/dynamic/RedisCommandsSyncIntegrationTests.java @@ -30,6 +30,7 @@ class RedisCommandsSyncIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisCommands redis; @Inject @@ -118,6 +119,7 @@ static int someStaticMethod() { @Command("MGET") List> mgetAsValues(String... keys); + } } diff --git a/src/test/java/io/lettuce/core/dynamic/SimpleBatcherUnitTests.java b/src/test/java/io/lettuce/core/dynamic/SimpleBatcherUnitTests.java index 404d92f9ff..11f425b2d1 100644 --- a/src/test/java/io/lettuce/core/dynamic/SimpleBatcherUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/SimpleBatcherUnitTests.java @@ -127,4 +127,5 @@ void shouldBatchWithBatchControlFlush() { private static RedisCommand createCommand() { return new AsyncCommand<>(new Command<>(CommandType.COMMAND, null, null)); } + } diff --git a/src/test/java/io/lettuce/core/dynamic/codec/AnnotationRedisCodecResolverUnitTests.java b/src/test/java/io/lettuce/core/dynamic/codec/AnnotationRedisCodecResolverUnitTests.java index 5f3bec050b..7c86802307 100644 --- a/src/test/java/io/lettuce/core/dynamic/codec/AnnotationRedisCodecResolverUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/codec/AnnotationRedisCodecResolverUnitTests.java @@ -147,6 +147,7 @@ private static interface CommandMethods { String withWrappers(@Value Range range, @Value io.lettuce.core.Value value); String withMap(Map map); + } } diff --git a/src/test/java/io/lettuce/core/dynamic/codec/ParameterWrappersUnitTests.java b/src/test/java/io/lettuce/core/dynamic/codec/ParameterWrappersUnitTests.java index 4358b41337..3eadb15d3d 100644 --- a/src/test/java/io/lettuce/core/dynamic/codec/ParameterWrappersUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/codec/ParameterWrappersUnitTests.java @@ -127,6 +127,7 @@ String withWrappers(Range range, io.lettuce.core.Value value, String withList(List map); String withMap(Map map); + } } diff --git a/src/test/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactoryUnitTests.java b/src/test/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactoryUnitTests.java index d5e78fdb37..afaabf21fb 100644 --- a/src/test/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/intercept/InvocationProxyFactoryUnitTests.java @@ -49,6 +49,7 @@ void shouldCallInterceptorsInOrder() { private interface TargetWithBooleanMethod { Boolean someMethod(); + } private static class ReturnValue implements MethodInterceptor { @@ -63,11 +64,13 @@ private static class ReturnValue implements MethodInterceptor { public Object invoke(MethodInvocation invocation) { return value; } + } private interface TargetWithStringMethod { String run(); + } private static class StringAppendingMethodInterceptor implements MethodInterceptor { @@ -82,5 +85,7 @@ private static class StringAppendingMethodInterceptor implements MethodIntercept public Object invoke(MethodInvocation invocation) throws Throwable { return invocation.proceed().toString() + toAppend; } + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/output/CodecAwareOutputResolverUnitTests.java b/src/test/java/io/lettuce/core/dynamic/output/CodecAwareOutputResolverUnitTests.java index c3b58c68b3..f20e53badf 100644 --- a/src/test/java/io/lettuce/core/dynamic/output/CodecAwareOutputResolverUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/output/CodecAwareOutputResolverUnitTests.java @@ -96,6 +96,7 @@ private static interface CommandMethods { String string(); ByteBuffer byteBuffer(); + } private static class ByteBufferAndStringCodec implements RedisCodec { @@ -119,5 +120,7 @@ public ByteBuffer encodeKey(ByteBuffer key) { public ByteBuffer encodeValue(String value) { return null; } + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryCommandOutputFactoryResolverUnitTests.java b/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryCommandOutputFactoryResolverUnitTests.java index 33b9e8cdcd..c6486cabb5 100644 --- a/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryCommandOutputFactoryResolverUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryCommandOutputFactoryResolverUnitTests.java @@ -141,8 +141,10 @@ void stringWildcardValueCollectionIsAssignableFromOutputs() { CommandOutput getCommandOutput(String methodName) { OutputSelector outputSelector = getOutputSelector(methodName); - CommandOutputFactory factory = resolver.resolveCommandOutput(Publisher.class.isAssignableFrom(outputSelector - .getOutputType().getRawClass()) ? unwrapReactiveType(outputSelector) : outputSelector); + CommandOutputFactory factory = resolver + .resolveCommandOutput(Publisher.class.isAssignableFrom(outputSelector.getOutputType().getRawClass()) + ? unwrapReactiveType(outputSelector) + : outputSelector); return factory.create(new StringCodec()); } @@ -196,5 +198,7 @@ private interface CommandMethods { List boolList(); ListOfMapsOutput listOfMapsOutput(); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryUnitTests.java b/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryUnitTests.java index e3e4aa3655..0d20f3401c 100644 --- a/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/output/OutputRegistryUnitTests.java @@ -93,6 +93,7 @@ private static abstract class IntermediateOutput extends CommandOutput codec, V1 output) { super(codec, null); } + } private static class KeyTypedOutput extends IntermediateOutput { @@ -100,5 +101,7 @@ private static class KeyTypedOutput extends IntermediateOutput codec) { super(codec, null); } + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/segment/AnnotationCommandSegmentFactoryUnitTests.java b/src/test/java/io/lettuce/core/dynamic/segment/AnnotationCommandSegmentFactoryUnitTests.java index cdde59c4cb..7363bb45b3 100644 --- a/src/test/java/io/lettuce/core/dynamic/segment/AnnotationCommandSegmentFactoryUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/segment/AnnotationCommandSegmentFactoryUnitTests.java @@ -22,8 +22,8 @@ class AnnotationCommandSegmentFactoryUnitTests { @Test void notAnnotatedDotAsIs() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class, - "notAnnotated")); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(CommandMethods.class, "notAnnotated")); CommandSegments commandSegments = factory.createCommandSegments(commandMethod); @@ -34,8 +34,8 @@ void notAnnotatedDotAsIs() { @Test void uppercaseDot() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils - .findMethod(CommandMethods.class, "upperCase")); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(CommandMethods.class, "upperCase")); CommandSegments commandSegments = factory.createCommandSegments(commandMethod); @@ -46,8 +46,8 @@ void uppercaseDot() { @Test void methodNameAsIs() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class, - "methodName")); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(CommandMethods.class, "methodName")); CommandSegments commandSegments = factory.createCommandSegments(commandMethod); @@ -58,8 +58,8 @@ void methodNameAsIs() { @Test void splitAsIs() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class, - "clientSetname")); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(CommandMethods.class, "clientSetname")); CommandSegments commandSegments = factory.createCommandSegments(commandMethod); @@ -70,8 +70,8 @@ void splitAsIs() { @Test void commandAnnotation() { - CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils - .findMethod(CommandMethods.class, "atCommand")); + CommandMethod commandMethod = DeclaredCommandMethod + .create(ReflectionUtils.findMethod(CommandMethods.class, "atCommand")); CommandSegments commandSegments = factory.createCommandSegments(commandMethod); @@ -107,10 +107,13 @@ private static interface CommandMethods { @Command("HELLO WORLD") void atCommand(); + } private static interface Defaulted { void clientSetname(); + } + } diff --git a/src/test/java/io/lettuce/core/dynamic/support/ParametrizedTypeInformationUnitTests.java b/src/test/java/io/lettuce/core/dynamic/support/ParametrizedTypeInformationUnitTests.java index f1e0b2940b..7b98b1dcbf 100644 --- a/src/test/java/io/lettuce/core/dynamic/support/ParametrizedTypeInformationUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/support/ParametrizedTypeInformationUnitTests.java @@ -93,6 +93,7 @@ private static interface TestType { List anything(); List numberOrSubtype(); + } private static interface ListOfNumber extends List { @@ -122,4 +123,5 @@ private static interface ListOfString extends List { private static interface ListOfInteger extends List { } + } diff --git a/src/test/java/io/lettuce/core/dynamic/support/WildcardTypeInformationUnitTests.java b/src/test/java/io/lettuce/core/dynamic/support/WildcardTypeInformationUnitTests.java index 652751169a..fe20304f66 100644 --- a/src/test/java/io/lettuce/core/dynamic/support/WildcardTypeInformationUnitTests.java +++ b/src/test/java/io/lettuce/core/dynamic/support/WildcardTypeInformationUnitTests.java @@ -95,5 +95,7 @@ private static interface GenericReturnTypes { List exactFloat(); List atLeastNumber(); + } + } diff --git a/src/test/java/io/lettuce/core/event/ConnectionEventsTriggeredIntegrationTests.java b/src/test/java/io/lettuce/core/event/ConnectionEventsTriggeredIntegrationTests.java index 54933a026e..ab91f9bd7f 100644 --- a/src/test/java/io/lettuce/core/event/ConnectionEventsTriggeredIntegrationTests.java +++ b/src/test/java/io/lettuce/core/event/ConnectionEventsTriggeredIntegrationTests.java @@ -37,4 +37,5 @@ void testConnectionEvents() { FastShutdown.shutdown(client); } + } diff --git a/src/test/java/io/lettuce/core/event/DefaultEventBusUnitTests.java b/src/test/java/io/lettuce/core/event/DefaultEventBusUnitTests.java index 3de1f9cebc..5d39762010 100644 --- a/src/test/java/io/lettuce/core/event/DefaultEventBusUnitTests.java +++ b/src/test/java/io/lettuce/core/event/DefaultEventBusUnitTests.java @@ -45,4 +45,5 @@ void publishToMultipleSubscribers() throws Exception { assertThat(arrayQueue.take()).isEqualTo(event); disposable1.dispose(); } + } diff --git a/src/test/java/io/lettuce/core/event/DefaultEventPublisherOptionsUnitTests.java b/src/test/java/io/lettuce/core/event/DefaultEventPublisherOptionsUnitTests.java index 6a3a9e3872..cdc9790fad 100644 --- a/src/test/java/io/lettuce/core/event/DefaultEventPublisherOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/event/DefaultEventPublisherOptionsUnitTests.java @@ -36,4 +36,5 @@ void testBuilder() { assertThat(sut.eventEmitInterval()).isEqualTo(Duration.ofSeconds(1)); } + } diff --git a/src/test/java/io/lettuce/core/internal/AbstractInvocationHandlerUnitTests.java b/src/test/java/io/lettuce/core/internal/AbstractInvocationHandlerUnitTests.java index 2392f58f85..6b1f2c17f7 100644 --- a/src/test/java/io/lettuce/core/internal/AbstractInvocationHandlerUnitTests.java +++ b/src/test/java/io/lettuce/core/internal/AbstractInvocationHandlerUnitTests.java @@ -57,10 +57,13 @@ static class InvocationHandler extends AbstractInvocationHandler { protected Object handleInvocation(Object proxy, Method method, Object[] args) { return 1; } + } static interface ReturnOne { + int returnOne(); + } } diff --git a/src/test/java/io/lettuce/core/internal/FuturesUnitTests.java b/src/test/java/io/lettuce/core/internal/FuturesUnitTests.java index 01e0f86ad5..1e3ec41789 100644 --- a/src/test/java/io/lettuce/core/internal/FuturesUnitTests.java +++ b/src/test/java/io/lettuce/core/internal/FuturesUnitTests.java @@ -55,4 +55,5 @@ void awaitAllShouldSetInterruptedBit() { assertThat(Thread.currentThread().isInterrupted()).isTrue(); } + } diff --git a/src/test/java/io/lettuce/core/internal/HostAndPortUnitTests.java b/src/test/java/io/lettuce/core/internal/HostAndPortUnitTests.java index 101f2ec3b8..273e8cae67 100644 --- a/src/test/java/io/lettuce/core/internal/HostAndPortUnitTests.java +++ b/src/test/java/io/lettuce/core/internal/HostAndPortUnitTests.java @@ -168,4 +168,5 @@ private static void checkFromCompatCase(String hpString, String expectHost, int assertThat(hostAndPort.getPort()).isEqualTo(expectPort); } + } diff --git a/src/test/java/io/lettuce/core/internal/TimeoutProviderUnitTests.java b/src/test/java/io/lettuce/core/internal/TimeoutProviderUnitTests.java index eaed022952..f14ae94ffc 100644 --- a/src/test/java/io/lettuce/core/internal/TimeoutProviderUnitTests.java +++ b/src/test/java/io/lettuce/core/internal/TimeoutProviderUnitTests.java @@ -50,4 +50,5 @@ void shouldReturnNoTimeout() { assertThat(timeout).isEqualTo(0); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/ConnectionsUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/ConnectionsUnitTests.java index a315a4cbb1..2c32c0c019 100644 --- a/src/test/java/io/lettuce/core/masterreplica/ConnectionsUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/ConnectionsUnitTests.java @@ -44,4 +44,5 @@ void shouldCloseConnectionCompletingAfterCloseSignal() { verify(connection1).closeAsync(); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/CustomCommandIntegrationTests.java b/src/test/java/io/lettuce/core/masterreplica/CustomCommandIntegrationTests.java index 7c7fc56edb..5d0702d15d 100644 --- a/src/test/java/io/lettuce/core/masterreplica/CustomCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/CustomCommandIntegrationTests.java @@ -31,6 +31,7 @@ class CustomCommandIntegrationTests extends TestSupport { private final RedisClient redisClient; private StatefulRedisConnection connection; + private RedisCommands redis; @Inject @@ -141,6 +142,7 @@ private StatefulRedisConnection getStandaloneConnection() { } public enum MyCommands implements ProtocolKeyword { + PING, SET, INFO; private final byte name[]; @@ -154,5 +156,7 @@ public enum MyCommands implements ProtocolKeyword { public byte[] getBytes() { return name; } + } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaChannelWriterUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaChannelWriterUnitTests.java index a52af6a72f..fead0e6a8f 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaChannelWriterUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaChannelWriterUnitTests.java @@ -72,11 +72,9 @@ void shouldReturnIntentForWriteCommand() { RedisCommand set = new Command<>(CommandType.SET, null); RedisCommand mset = new Command<>(CommandType.MSET, null); - assertThat(writer.getIntent(Arrays.asList(set, mset))) - .isEqualTo(ConnectionIntent.WRITE); + assertThat(writer.getIntent(Arrays.asList(set, mset))).isEqualTo(ConnectionIntent.WRITE); - assertThat(writer.getIntent(Collections.singletonList(set))) - .isEqualTo(ConnectionIntent.WRITE); + assertThat(writer.getIntent(Collections.singletonList(set))).isEqualTo(ConnectionIntent.WRITE); } @Test @@ -84,8 +82,7 @@ void shouldReturnDefaultIntentForNoCommands() { MasterReplicaChannelWriter writer = new MasterReplicaChannelWriter(connectionProvider, clientResources, clientOptions); - assertThat(writer.getIntent(Collections.emptyList())) - .isEqualTo(ConnectionIntent.WRITE); + assertThat(writer.getIntent(Collections.emptyList())).isEqualTo(ConnectionIntent.WRITE); } @Test @@ -96,11 +93,9 @@ void shouldReturnIntentForReadCommand() { RedisCommand get = new Command<>(CommandType.GET, null); RedisCommand mget = new Command<>(CommandType.MGET, null); - assertThat(writer.getIntent(Arrays.asList(get, mget))) - .isEqualTo(ConnectionIntent.READ); + assertThat(writer.getIntent(Arrays.asList(get, mget))).isEqualTo(ConnectionIntent.READ); - assertThat(writer.getIntent(Collections.singletonList(get))) - .isEqualTo(ConnectionIntent.READ); + assertThat(writer.getIntent(Collections.singletonList(get))).isEqualTo(ConnectionIntent.READ); } @Test @@ -111,11 +106,9 @@ void shouldReturnIntentForMixedCommands() { RedisCommand set = new Command<>(CommandType.SET, null); RedisCommand mget = new Command<>(CommandType.MGET, null); - assertThat(writer.getIntent(Arrays.asList(set, mget))) - .isEqualTo(ConnectionIntent.WRITE); + assertThat(writer.getIntent(Arrays.asList(set, mget))).isEqualTo(ConnectionIntent.WRITE); - assertThat(writer.getIntent(Collections.singletonList(set))) - .isEqualTo(ConnectionIntent.WRITE); + assertThat(writer.getIntent(Collections.singletonList(set))).isEqualTo(ConnectionIntent.WRITE); } @Test @@ -202,4 +195,5 @@ void shouldDeriveIntentFromCommandBatchTypeAfterDiscardedTransaction() { private static Command mockCommand(CommandType multi) { return new Command<>(multi, new StatusOutput<>(StringCodec.UTF8)); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaSentinelSslIntegrationTests.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaSentinelSslIntegrationTests.java index 807faacdb6..5e19c1a679 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaSentinelSslIntegrationTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaSentinelSslIntegrationTests.java @@ -56,4 +56,5 @@ void testMasterReplicaSentinelBasic() { FastShutdown.shutdown(client); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTest.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTest.java index d0fe107460..97c3d27a8c 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTest.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTest.java @@ -38,9 +38,11 @@ class MasterReplicaTest extends AbstractRedisClientTest { private StatefulRedisMasterReplicaConnection connection; private RedisURI upstream; + private RedisURI replica; private RedisCommands connection1; + private RedisCommands connection2; @BeforeEach @@ -151,10 +153,12 @@ void testConnectToReplica() { void noReplicaForRead() { connection.setReadFrom(new ReadFrom() { + @Override public List select(Nodes nodes) { return Collections.emptyList(); } + }); assertThatThrownBy(() -> replicaCall(connection)).isInstanceOf(RedisException.class); @@ -188,4 +192,5 @@ void testConnectToReplicaWithAcl() { static String replicaCall(StatefulRedisMasterReplicaConnection connection) { return connection.sync().info("replication"); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyProviderUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyProviderUnitTests.java index 328dc74ee7..dc354e4175 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyProviderUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyProviderUnitTests.java @@ -103,7 +103,6 @@ void shouldParseIPv6UpstreamAddress() { List result = sut.getNodesFromInfo(info); assertThat(result).hasSize(2); - RedisNodeDescription replica = result.get(0); assertThat(replica.getRole().isReplica()).isTrue(); @@ -164,8 +163,7 @@ void shouldParseReplicas() { void shouldParseIPv6SlaveAddress() { String info = "# Replication\r\n" + "role:master\r\n" - + "slave0:ip=::20f8:1400:0:0,port=6483,state=online,offset=56276,lag=0\r\n" - + "master_repl_offset:56276\r\n" + + "slave0:ip=::20f8:1400:0:0,port=6483,state=online,offset=56276,lag=0\r\n" + "master_repl_offset:56276\r\n" + "repl_backlog_active:1\r\n"; List result = sut.getNodesFromInfo(info); @@ -177,4 +175,5 @@ void shouldParseIPv6SlaveAddress() { assertThat(replica1.getUri().getHost()).isEqualTo("::20f8:1400:0:0"); assertThat(replica1.getUri().getPort()).isEqualTo(6483); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyRefreshUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyRefreshUnitTests.java index 3ba3071c10..ee305db84c 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyRefreshUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaTopologyRefreshUnitTests.java @@ -78,8 +78,7 @@ void tearDown() { @Test void shouldRetrieveTopology() { - MasterReplicaTopologyRefresh refresh = new MasterReplicaTopologyRefresh(connectionFactory, executorService, - provider); + MasterReplicaTopologyRefresh refresh = new MasterReplicaTopologyRefresh(connectionFactory, executorService, provider); CompletableFuture> master = CompletableFuture.completedFuture(connection); CompletableFuture> replica = CompletableFuture.completedFuture(connection); @@ -97,8 +96,7 @@ void shouldRetrieveTopology() { @Test void shouldRetrieveTopologyWithFailedNode() { - MasterReplicaTopologyRefresh refresh = new MasterReplicaTopologyRefresh(connectionFactory, executorService, - provider); + MasterReplicaTopologyRefresh refresh = new MasterReplicaTopologyRefresh(connectionFactory, executorService, provider); CompletableFuture> connected = CompletableFuture.completedFuture(connection); CompletableFuture> pending = new CompletableFuture<>(); @@ -112,4 +110,5 @@ void shouldRetrieveTopologyWithFailedNode() { assertThat(nodes).hasSize(1).containsOnly(UPSTREAM); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaUtilsUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaUtilsUnitTests.java index 78b15067a8..107bd5f6bd 100644 --- a/src/test/java/io/lettuce/core/masterreplica/MasterReplicaUtilsUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/MasterReplicaUtilsUnitTests.java @@ -85,4 +85,5 @@ void isChangedShouldReturnTrueBecauseRolesSwitched() { assertThat(ReplicaUtils.isChanged(Arrays.asList(upstream, replica), Arrays.asList(newupstream, newslave))).isTrue(); assertThat(ReplicaUtils.isChanged(Arrays.asList(upstream, replica), Arrays.asList(newslave, newupstream))).isTrue(); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/SentinelTopologyRefreshUnitTests.java b/src/test/java/io/lettuce/core/masterreplica/SentinelTopologyRefreshUnitTests.java index a8e1d74453..ba1b95148c 100644 --- a/src/test/java/io/lettuce/core/masterreplica/SentinelTopologyRefreshUnitTests.java +++ b/src/test/java/io/lettuce/core/masterreplica/SentinelTopologyRefreshUnitTests.java @@ -48,6 +48,7 @@ class SentinelTopologyRefreshUnitTests { private static final RedisURI host1 = RedisURI.create("localhost", 1234); + private static final RedisURI host2 = RedisURI.create("localhost", 3456); @Mock @@ -76,8 +77,8 @@ class SentinelTopologyRefreshUnitTests { @BeforeEach void before() { - when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host1))).thenReturn( - ConnectionFuture.completed(null, connection)); + when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host1))) + .thenReturn(ConnectionFuture.completed(null, connection)); when(clientResources.eventExecutorGroup()).thenReturn(eventExecutors); when(redisClient.getResources()).thenReturn(clientResources); when(connection.async()).thenReturn(pubSubAsyncCommands); @@ -111,8 +112,8 @@ void bindWithSecondSentinelFails() { sut = new SentinelTopologyRefresh(redisClient, "mymaster", Arrays.asList(host1, host2)); - when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host2))).thenReturn( - ConnectionFuture.from(null, Futures.failed(new RedisConnectionException("err")))); + when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host2))) + .thenReturn(ConnectionFuture.from(null, Futures.failed(new RedisConnectionException("err")))); sut.bind(refreshRunnable); @@ -136,9 +137,9 @@ void bindWithSentinelRecovery() { sut = new SentinelTopologyRefresh(redisClient, "mymaster", Arrays.asList(host1, host2)); - when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host2))).thenReturn( - ConnectionFuture.from(null, Futures.failed(new RedisConnectionException("err")))).thenReturn( - ConnectionFuture.completed(null, connection2)); + when(redisClient.connectPubSubAsync(any(StringCodec.class), eq(host2))) + .thenReturn(ConnectionFuture.from(null, Futures.failed(new RedisConnectionException("err")))) + .thenReturn(ConnectionFuture.completed(null, connection2)); sut.bind(refreshRunnable); @@ -382,4 +383,5 @@ void shouldNotProcessIfExecutorIsShuttingDown() { private PubSubMessageHandler getMessageHandler() { return ReflectionTestUtils.getField(sut, "messageHandler"); } + } diff --git a/src/test/java/io/lettuce/core/masterreplica/StaticMasterReplicaTest.java b/src/test/java/io/lettuce/core/masterreplica/StaticMasterReplicaTest.java index 3b12a81e9e..0828ddfab2 100644 --- a/src/test/java/io/lettuce/core/masterreplica/StaticMasterReplicaTest.java +++ b/src/test/java/io/lettuce/core/masterreplica/StaticMasterReplicaTest.java @@ -33,9 +33,11 @@ class StaticMasterReplicaTest extends AbstractRedisClientTest { private StatefulRedisMasterReplicaConnection connection; private RedisURI upstream; + private RedisURI replica; private RedisCommands connection1; + private RedisCommands connection2; @BeforeEach @@ -208,4 +210,5 @@ MasterReplicaConnectionProvider getConnectionProvider() { MasterReplicaChannelWriter writer = ((StatefulRedisMasterReplicaConnectionImpl) connection).getChannelWriter(); return writer.getUpstreamReplicaConnectionProvider(); } + } diff --git a/src/test/java/io/lettuce/core/masterslave/MasterSlaveSentinelIntegrationTests.java b/src/test/java/io/lettuce/core/masterslave/MasterSlaveSentinelIntegrationTests.java index ca8ec06d03..9a0a5b603a 100644 --- a/src/test/java/io/lettuce/core/masterslave/MasterSlaveSentinelIntegrationTests.java +++ b/src/test/java/io/lettuce/core/masterslave/MasterSlaveSentinelIntegrationTests.java @@ -28,6 +28,7 @@ class MasterSlaveSentinelIntegrationTests extends TestSupport { private final Pattern pattern = Pattern.compile("role:(\\w+)"); + private final RedisClient redisClient; @Inject @@ -133,4 +134,5 @@ private void assertThatServerIs(String server, String expectation) { assertThat(matcher.find()).isTrue(); assertThat(matcher.group(1)).isEqualTo(expectation); } + } diff --git a/src/test/java/io/lettuce/core/masterslave/MasterSlaveTest.java b/src/test/java/io/lettuce/core/masterslave/MasterSlaveTest.java index 645bbd66e9..009bc24536 100644 --- a/src/test/java/io/lettuce/core/masterslave/MasterSlaveTest.java +++ b/src/test/java/io/lettuce/core/masterslave/MasterSlaveTest.java @@ -36,9 +36,11 @@ class MasterSlaveTest extends AbstractRedisClientTest { private StatefulRedisMasterSlaveConnection connection; private RedisURI upstream; + private RedisURI replica; private RedisCommands connection1; + private RedisCommands connection2; @BeforeEach @@ -149,10 +151,12 @@ void testConnectToSlave() { void noSlaveForRead() { connection.setReadFrom(new ReadFrom() { + @Override public List select(Nodes nodes) { return Collections.emptyList(); } + }); assertThatThrownBy(() -> slaveCall(connection)).isInstanceOf(RedisException.class); diff --git a/src/test/java/io/lettuce/core/masterslave/StaticMasterSlaveTest.java b/src/test/java/io/lettuce/core/masterslave/StaticMasterSlaveTest.java index 19f590186e..91d0ea4f4f 100644 --- a/src/test/java/io/lettuce/core/masterslave/StaticMasterSlaveTest.java +++ b/src/test/java/io/lettuce/core/masterslave/StaticMasterSlaveTest.java @@ -30,9 +30,11 @@ class StaticMasterSlaveTest extends AbstractRedisClientTest { private StatefulRedisMasterSlaveConnection connection; private RedisURI upstream; + private RedisURI replica; private RedisCommands connection1; + private RedisCommands connection2; @BeforeEach diff --git a/src/test/java/io/lettuce/core/metrics/CommandLatencyCollectorOptionsUnitTests.java b/src/test/java/io/lettuce/core/metrics/CommandLatencyCollectorOptionsUnitTests.java index 79611b6afd..91734cd678 100644 --- a/src/test/java/io/lettuce/core/metrics/CommandLatencyCollectorOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/metrics/CommandLatencyCollectorOptionsUnitTests.java @@ -33,10 +33,11 @@ class CommandLatencyCollectorOptionsUnitTests { @Test void testBuilder() { - CommandLatencyCollectorOptions sut = CommandLatencyCollectorOptions.builder() - .targetUnit(TimeUnit.HOURS).targetPercentiles(new double[] { 1, 2, 3 }).build(); + CommandLatencyCollectorOptions sut = CommandLatencyCollectorOptions.builder().targetUnit(TimeUnit.HOURS) + .targetPercentiles(new double[] { 1, 2, 3 }).build(); assertThat(sut.targetPercentiles()).hasSize(3); assertThat(sut.targetUnit()).isEqualTo(TimeUnit.HOURS); } + } diff --git a/src/test/java/io/lettuce/core/metrics/CommandLatencyIdUnitTests.java b/src/test/java/io/lettuce/core/metrics/CommandLatencyIdUnitTests.java index e4e0b3704f..f6f32247b3 100644 --- a/src/test/java/io/lettuce/core/metrics/CommandLatencyIdUnitTests.java +++ b/src/test/java/io/lettuce/core/metrics/CommandLatencyIdUnitTests.java @@ -57,5 +57,7 @@ public byte[] getBytes() { public String name() { return name; } + } + } diff --git a/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptionsUnitTests.java b/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptionsUnitTests.java index 2d6c1880b8..84c99a9241 100644 --- a/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptionsUnitTests.java +++ b/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorOptionsUnitTests.java @@ -31,10 +31,11 @@ void testDisabled() { @Test void testBuilder() { - DefaultCommandLatencyCollectorOptions sut = DefaultCommandLatencyCollectorOptions.builder() - .targetUnit(TimeUnit.HOURS).targetPercentiles(new double[] { 1, 2, 3 }).build(); + DefaultCommandLatencyCollectorOptions sut = DefaultCommandLatencyCollectorOptions.builder().targetUnit(TimeUnit.HOURS) + .targetPercentiles(new double[] { 1, 2, 3 }).build(); assertThat(sut.targetPercentiles()).hasSize(3); assertThat(sut.targetUnit()).isEqualTo(TimeUnit.HOURS); } + } diff --git a/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorUnitTests.java b/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorUnitTests.java index 6456551c13..3fba67c3dc 100644 --- a/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorUnitTests.java +++ b/src/test/java/io/lettuce/core/metrics/DefaultCommandLatencyCollectorUnitTests.java @@ -96,8 +96,7 @@ void shutdownShouldReleasePauseDetector() { @Test void verifyMetrics() { - sut = new DefaultCommandLatencyCollector(DefaultCommandLatencyCollectorOptions - .builder().usePauseDetector().build()); + sut = new DefaultCommandLatencyCollector(DefaultCommandLatencyCollectorOptions.builder().usePauseDetector().build()); setupData(); @@ -118,8 +117,8 @@ void verifyMetrics() { assertThat(metrics.getFirstResponse().getMax()).isBetween(290000L, 310000L); assertThat(metrics.getCompletion().getPercentiles()).containsKey(50.0d); - assertThat(metrics.getFirstResponse().getPercentiles().get(50d)).isLessThanOrEqualTo( - metrics.getCompletion().getPercentiles().get(50d)); + assertThat(metrics.getFirstResponse().getPercentiles().get(50d)) + .isLessThanOrEqualTo(metrics.getCompletion().getPercentiles().get(50d)); assertThat(metrics.getTimeUnit()).isEqualTo(MICROSECONDS); @@ -131,9 +130,8 @@ void verifyMetrics() { @Test void verifyCummulativeMetrics() { - sut = new DefaultCommandLatencyCollector(DefaultCommandLatencyCollectorOptions.builder() - .usePauseDetector() - .resetLatenciesAfterEvent(false).build()); + sut = new DefaultCommandLatencyCollector( + DefaultCommandLatencyCollectorOptions.builder().usePauseDetector().resetLatenciesAfterEvent(false).build()); setupData(); @@ -151,4 +149,5 @@ private void setupData() { sut.recordCommandLatency(LocalAddress.ANY, LocalAddress.ANY, CommandType.BGSAVE, MILLISECONDS.toNanos(300), MILLISECONDS.toNanos(1000)); } + } diff --git a/src/test/java/io/lettuce/core/metrics/MicrometerCommandLatencyRecorderUnitTests.java b/src/test/java/io/lettuce/core/metrics/MicrometerCommandLatencyRecorderUnitTests.java index 167e3d07de..edd1f63656 100644 --- a/src/test/java/io/lettuce/core/metrics/MicrometerCommandLatencyRecorderUnitTests.java +++ b/src/test/java/io/lettuce/core/metrics/MicrometerCommandLatencyRecorderUnitTests.java @@ -69,14 +69,12 @@ void verifyMetrics() { assertThat(meterRegistry.find(METRIC_FIRST_RESPONSE).timers()).hasSize(2); assertThat(meterRegistry.find(METRIC_FIRST_RESPONSE).tag(LABEL_COMMAND, CommandType.BGSAVE.name()).timers()).hasSize(1) .element(0).extracting(Timer::takeSnapshot).hasFieldOrPropertyWithValue("count", 3L) - .hasFieldOrPropertyWithValue("max", 300.0) - .hasFieldOrPropertyWithValue("total", 600.0); + .hasFieldOrPropertyWithValue("max", 300.0).hasFieldOrPropertyWithValue("total", 600.0); assertThat(meterRegistry.find(METRIC_COMPLETION).timers()).hasSize(2); assertThat(meterRegistry.find(METRIC_COMPLETION).tag(LABEL_COMMAND, CommandType.BGSAVE.name()).timers()).hasSize(1) .element(0).extracting(Timer::takeSnapshot).hasFieldOrPropertyWithValue("count", 3L) - .hasFieldOrPropertyWithValue("max", 1500.0) - .hasFieldOrPropertyWithValue("total", 3000.0); + .hasFieldOrPropertyWithValue("max", 1500.0).hasFieldOrPropertyWithValue("total", 3000.0); } @Test @@ -186,7 +184,8 @@ void enabledCommandsNotEmpty() { assertThat(meterRegistry.find(METRIC_FIRST_RESPONSE).timers()).hasSize(1); assertThat(meterRegistry.find(METRIC_COMPLETION).tag(LABEL_COMMAND, CommandType.CLUSTER.name()).timers()).hasSize(1); - assertThat(meterRegistry.find(METRIC_FIRST_RESPONSE).tag(LABEL_COMMAND, CommandType.CLUSTER.name()).timers()).hasSize(1); + assertThat(meterRegistry.find(METRIC_FIRST_RESPONSE).tag(LABEL_COMMAND, CommandType.CLUSTER.name()).timers()) + .hasSize(1); } } diff --git a/src/test/java/io/lettuce/core/models/role/RoleParserUnitTests.java b/src/test/java/io/lettuce/core/models/role/RoleParserUnitTests.java index ef3ec549b7..ddd7440502 100644 --- a/src/test/java/io/lettuce/core/models/role/RoleParserUnitTests.java +++ b/src/test/java/io/lettuce/core/models/role/RoleParserUnitTests.java @@ -17,7 +17,9 @@ class RoleParserUnitTests { private static final long REPLICATION_OFFSET_1 = 3167038L; + private static final long REPLICATION_OFFSET_2 = 3167039L; + private static final String LOCALHOST = "127.0.0.1"; @Test @@ -32,8 +34,8 @@ void emptyList() { @Test void invalidFirstElement() { - assertThatThrownBy(() -> RoleParser.parse(LettuceLists.newList(new Object()))).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> RoleParser.parse(LettuceLists.newList(new Object()))) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -90,7 +92,8 @@ void replica() { @Test void sentinel() { - List input = LettuceLists.newList("sentinel", LettuceLists.newList("resque-master", "html-fragments-master", "stats-master")); + List input = LettuceLists.newList("sentinel", + LettuceLists.newList("resque-master", "html-fragments-master", "stats-master")); RedisInstance result = RoleParser.parse(input); @@ -152,4 +155,5 @@ void testModelTest() { assertThat(partner.toString()).contains(ReplicationPartner.class.getSimpleName()); } + } diff --git a/src/test/java/io/lettuce/core/models/stream/PendingParserUnitTests.java b/src/test/java/io/lettuce/core/models/stream/PendingParserUnitTests.java index c00e0a0c0a..cdcddf71d5 100644 --- a/src/test/java/io/lettuce/core/models/stream/PendingParserUnitTests.java +++ b/src/test/java/io/lettuce/core/models/stream/PendingParserUnitTests.java @@ -20,8 +20,7 @@ class PendingParserUnitTests { void shouldParseXpendingWithRangeOutput() { List result = PendingParser - .parseRange(Collections.singletonList(Arrays.asList("foo", "consumer", 1L, - 2L))); + .parseRange(Collections.singletonList(Arrays.asList("foo", "consumer", 1L, 2L))); assertThat(result).hasSize(1); @@ -37,11 +36,12 @@ void shouldParseXpendingWithRangeOutput() { @Test void shouldParseXpendingOutput() { - PendingMessages result = PendingParser.parse(Arrays.asList(16L, "from", "to", - Collections.singletonList(Arrays.asList("consumer", 17L)))); + PendingMessages result = PendingParser + .parse(Arrays.asList(16L, "from", "to", Collections.singletonList(Arrays.asList("consumer", 17L)))); assertThat(result.getCount()).isEqualTo(16); assertThat(result.getMessageIds()).isEqualTo(Range.create("from", "to")); assertThat(result.getConsumerMessageCount()).containsEntry("consumer", 17L); } + } diff --git a/src/test/java/io/lettuce/core/output/BooleanListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/BooleanListOutputUnitTests.java index 6ae5cb0392..f3406b867a 100644 --- a/src/test/java/io/lettuce/core/output/BooleanListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/BooleanListOutputUnitTests.java @@ -36,4 +36,5 @@ void setByteNotImplemented() { assertThatThrownBy(() -> sut.set(ByteBuffer.wrap("4.567".getBytes()))) .isInstanceOf(UnsupportedOperationException.class); } + } diff --git a/src/test/java/io/lettuce/core/output/GeoCoordinatesListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/GeoCoordinatesListOutputUnitTests.java index fb6a9352cf..6f14c5271b 100644 --- a/src/test/java/io/lettuce/core/output/GeoCoordinatesListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/GeoCoordinatesListOutputUnitTests.java @@ -31,4 +31,5 @@ void commandOutputCorrectlyDecoded() { assertThat(sut.get()).contains(new GeoCoordinates(1.234, 4.567)); } + } diff --git a/src/test/java/io/lettuce/core/output/GeoCoordinatesValueListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/GeoCoordinatesValueListOutputUnitTests.java index 3208af1666..085dcc90b3 100644 --- a/src/test/java/io/lettuce/core/output/GeoCoordinatesValueListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/GeoCoordinatesValueListOutputUnitTests.java @@ -37,4 +37,5 @@ void commandOutputCorrectlyDecoded() { assertThat(sut.get()).contains(Value.just(new GeoCoordinates(1.234, 4.567))); } + } diff --git a/src/test/java/io/lettuce/core/output/GeoWithinListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/GeoWithinListOutputUnitTests.java index bf0f5d5bbd..b173391f19 100644 --- a/src/test/java/io/lettuce/core/output/GeoWithinListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/GeoWithinListOutputUnitTests.java @@ -88,4 +88,5 @@ void commandOutputKeyAndCoordinatesDecoded() { assertThat(sut.get()).contains(new GeoWithin<>("key", null, null, new GeoCoordinates(1.234, 4.567))); } + } diff --git a/src/test/java/io/lettuce/core/output/ListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/ListOutputUnitTests.java index 004504a084..8c1831f192 100644 --- a/src/test/java/io/lettuce/core/output/ListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/ListOutputUnitTests.java @@ -63,8 +63,11 @@ void setValueShouldConvert(Fixture fixture) { static class Fixture { final CommandOutput> commandOutput; + final StreamingOutput streamingOutput; + final byte[] valueBytes; + final Object value; Fixture(CommandOutput commandOutput, StreamingOutput streamingOutput, byte[] valueBytes, Object value) { @@ -79,5 +82,7 @@ static class Fixture { public String toString() { return commandOutput.getClass().getSimpleName() + "/" + value; } + } + } diff --git a/src/test/java/io/lettuce/core/output/MultiOutputUnitTests.java b/src/test/java/io/lettuce/core/output/MultiOutputUnitTests.java index 02e00deeb8..a7b9792d09 100644 --- a/src/test/java/io/lettuce/core/output/MultiOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/MultiOutputUnitTests.java @@ -60,4 +60,5 @@ void shouldFailMulti() { assertThat(command.getOutput().getError()).isNull(); assertThat(output.getError()).isEqualTo("Fail"); } + } diff --git a/src/test/java/io/lettuce/core/output/ObjectOutputTests.java b/src/test/java/io/lettuce/core/output/ObjectOutputTests.java index b26c6e4fd3..87c0fa9813 100644 --- a/src/test/java/io/lettuce/core/output/ObjectOutputTests.java +++ b/src/test/java/io/lettuce/core/output/ObjectOutputTests.java @@ -23,147 +23,70 @@ class ObjectOutputTests { void shouldParseHelloWithModules() { String in = "%7\r\n" - // 1 - + "$6\r\n" - + "server\r\n" - + "$5\r\n" - + "redis\r\n" + // 1 + + "$6\r\n" + "server\r\n" + "$5\r\n" + "redis\r\n" // 2 - + "$7\r\n" - + "version\r\n" - + "$5\r\n" - + "7.2.0\r\n" + + "$7\r\n" + "version\r\n" + "$5\r\n" + "7.2.0\r\n" // 3 - + "$5\r\n" - + "proto\r\n" - + ":3\r\n" + + "$5\r\n" + "proto\r\n" + ":3\r\n" // 4 - + "$2\r\n" - + "id\r\n" - + ":3\r\n" + + "$2\r\n" + "id\r\n" + ":3\r\n" // 5 - + "$4\r\n" - + "mode\r\n" - + "$7\r\n" - + "cluster\r\n" + + "$4\r\n" + "mode\r\n" + "$7\r\n" + "cluster\r\n" // 6 - + "$4\r\n" - + "role\r\n" - + "$6\r\n" - + "master\r\n" + + "$4\r\n" + "role\r\n" + "$6\r\n" + "master\r\n" // 7 - + "$7\r\n" - + "modules\r\n" + + "$7\r\n" + "modules\r\n" // list + "*4\r\n" // map + "%4\r\n" - + "$4\r\n" - + "name\r\n" - + "$10\r\n" - + "timeseries\r\n" + + "$4\r\n" + "name\r\n" + "$10\r\n" + "timeseries\r\n" - + "$3\r\n" - + "ver\r\n" - + ":11001\r\n" + + "$3\r\n" + "ver\r\n" + ":11001\r\n" - + "$4\r\n" - + "path\r\n" - + "$19\r\n" - + "/enterprise-managed\r\n" + + "$4\r\n" + "path\r\n" + "$19\r\n" + "/enterprise-managed\r\n" - + "$4\r\n" - + "args\r\n" - + "*0\r\n" + + "$4\r\n" + "args\r\n" + "*0\r\n" // elem 1 + "%4\r\n" - + "$4\r\n" - + "name\r\n" - + "$11\r\n" - + "searchlight\r\n" + + "$4\r\n" + "name\r\n" + "$11\r\n" + "searchlight\r\n" - + "$3\r\n" - + "ver\r\n" - + ":20803\r\n" + + "$3\r\n" + "ver\r\n" + ":20803\r\n" - + "$4\r\n" - + "path\r\n" - + "$19\r\n" - + "/enterprise-managed\r\n" + + "$4\r\n" + "path\r\n" + "$19\r\n" + "/enterprise-managed\r\n" - + "$4\r\n" - + "args\r\n" + + "$4\r\n" + "args\r\n" + "*10\r\n" // 1 - + "$23\r\n" - + "FORK_GC_CLEAN_THRESHOLD\r\n" - + "$3\r\n" - + "100\r\n" + + "$23\r\n" + "FORK_GC_CLEAN_THRESHOLD\r\n" + "$3\r\n" + "100\r\n" // 2 - + "$19\r\n" - + "MAXAGGREGATERESULTS\r\n" - + "$5\r\n" - + "10000\r\n" + + "$19\r\n" + "MAXAGGREGATERESULTS\r\n" + "$5\r\n" + "10000\r\n" // 3 - + "$16\r\n" - + "MAXSEARCHRESULTS\r\n" - + "$5\r\n" - + "10000\r\n" + + "$16\r\n" + "MAXSEARCHRESULTS\r\n" + "$5\r\n" + "10000\r\n" // 4 - + "$7\r\n" - + "MT_MODE\r\n" - + "$26\r\n" - + "MT_MODE_ONLY_ON_OPERATIONS\r\n" + + "$7\r\n" + "MT_MODE\r\n" + "$26\r\n" + "MT_MODE_ONLY_ON_OPERATIONS\r\n" // 5 - + "$14\r\n" - + "WORKER_THREADS\r\n" - + "$1\r\n" - + "4\r\n" + + "$14\r\n" + "WORKER_THREADS\r\n" + "$1\r\n" + "4\r\n" // 6 - + "%4\r\n" - + "$4\r\n" - + "name\r\n" - + "$6\r\n" - + "ReJSON\r\n" - + "$3\r\n" - + "ver\r\n" - + ":20602\r\n" - + "$4\r\n" - + "path\r\n" - + "$19\r\n" - + "/enterprise-managed\r\n" - + "$4\r\n" - + "args\r\n" - + "*0\r\n" + + "%4\r\n" + "$4\r\n" + "name\r\n" + "$6\r\n" + "ReJSON\r\n" + "$3\r\n" + "ver\r\n" + ":20602\r\n" + "$4\r\n" + + "path\r\n" + "$19\r\n" + "/enterprise-managed\r\n" + "$4\r\n" + "args\r\n" + "*0\r\n" - + "%4\r\n" - + "$4\r\n" - + "name\r\n" - + "$2\r\n" - + "bf\r\n" - + "$3\r\n" - + "ver\r\n" - + ":20601\r\n" - + "$4\r\n" - + "path\r\n" - + "$19\r\n" - + "/enterprise-managed\r\n" - + "$4\r\n" - + "args\r\n" - + "*0\r\n"; + + "%4\r\n" + "$4\r\n" + "name\r\n" + "$2\r\n" + "bf\r\n" + "$3\r\n" + "ver\r\n" + ":20601\r\n" + "$4\r\n" + + "path\r\n" + "$19\r\n" + "/enterprise-managed\r\n" + "$4\r\n" + "args\r\n" + "*0\r\n"; RedisStateMachine rsm = new RedisStateMachine(ByteBufAllocator.DEFAULT); ObjectOutput output = new ObjectOutput<>(StringCodec.UTF8); @@ -183,4 +106,5 @@ void shouldParseHelloWithModules() { List args = (List) searchlight.get("args"); assertThat(args).containsSequence("MAXSEARCHRESULTS", "10000"); } + } diff --git a/src/test/java/io/lettuce/core/output/ReplayOutputUnitTests.java b/src/test/java/io/lettuce/core/output/ReplayOutputUnitTests.java index e55a82df9b..c6c3dee693 100644 --- a/src/test/java/io/lettuce/core/output/ReplayOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/ReplayOutputUnitTests.java @@ -64,4 +64,5 @@ void shouldDecodeErrorResponse() { assertThat(replay.getError()).isEqualTo("foo"); assertThat(target.getError()).isEqualTo("foo"); } + } diff --git a/src/test/java/io/lettuce/core/output/ScoredValueListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/ScoredValueListOutputUnitTests.java index 2990b83393..2b357b6b1b 100644 --- a/src/test/java/io/lettuce/core/output/ScoredValueListOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/ScoredValueListOutputUnitTests.java @@ -38,4 +38,5 @@ void commandOutputCorrectlyDecoded() { assertThat(sut.get()).contains(ScoredValue.just(4.567, "key")); } + } diff --git a/src/test/java/io/lettuce/core/output/SocketAddressOutputUnitTests.java b/src/test/java/io/lettuce/core/output/SocketAddressOutputUnitTests.java index 5573da7d46..dcb741abdc 100644 --- a/src/test/java/io/lettuce/core/output/SocketAddressOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/SocketAddressOutputUnitTests.java @@ -26,4 +26,5 @@ void shouldReportSocketAddress() { assertThat(output.get()).isNotNull().isInstanceOf(InetSocketAddress.class); } + } diff --git a/src/test/java/io/lettuce/core/output/StreamReadOutputUnitTests.java b/src/test/java/io/lettuce/core/output/StreamReadOutputUnitTests.java index 29d14f4aee..3b9eddee7c 100644 --- a/src/test/java/io/lettuce/core/output/StreamReadOutputUnitTests.java +++ b/src/test/java/io/lettuce/core/output/StreamReadOutputUnitTests.java @@ -175,4 +175,5 @@ void shouldDecodeFromTwoStreams() { assertThat(streamMessage2.getStream()).isEqualTo("stream2"); assertThat(streamMessage2.getBody()).hasSize(1).containsEntry("key2", "value2"); } + } diff --git a/src/test/java/io/lettuce/core/protocol/AsyncCommandUnitTests.java b/src/test/java/io/lettuce/core/protocol/AsyncCommandUnitTests.java index 6b5e43c40b..6e85a0a49a 100644 --- a/src/test/java/io/lettuce/core/protocol/AsyncCommandUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/AsyncCommandUnitTests.java @@ -28,7 +28,9 @@ public class AsyncCommandUnitTests { private RedisCodec codec = StringCodec.UTF8; + private Command internal; + private AsyncCommand sut; @BeforeEach @@ -84,8 +86,7 @@ void awaitWithExecutionException() { @Test void awaitWithCancelledCommand() { sut.cancel(); - assertThatThrownBy(() -> Futures.awaitOrCancel(sut, 5, TimeUnit.SECONDS)) - .isInstanceOf(CancellationException.class); + assertThatThrownBy(() -> Futures.awaitOrCancel(sut, 5, TimeUnit.SECONDS)).isInstanceOf(CancellationException.class); } @Test @@ -177,10 +178,12 @@ void awaitInterrupted2() { @Test void outputSubclassOverride1() { CommandOutput output = new CommandOutput(codec, null) { + @Override public String get() throws RedisException { return null; } + }; assertThatThrownBy(() -> output.set(null)).isInstanceOf(UnsupportedOperationException.class); } @@ -188,10 +191,12 @@ public String get() throws RedisException { @Test void outputSubclassOverride2() { CommandOutput output = new CommandOutput(codec, null) { + @Override public String get() throws RedisException { return null; } + }; assertThatThrownBy(() -> output.set(0)).isInstanceOf(UnsupportedOperationException.class); } @@ -203,11 +208,14 @@ void sillyTestsForEmmaCoverage() { } private enum MyKeywords implements ProtocolKeyword { + DUMMY; @Override public byte[] getBytes() { return name().getBytes(); } + } + } diff --git a/src/test/java/io/lettuce/core/protocol/CommandArgsUnitTests.java b/src/test/java/io/lettuce/core/protocol/CommandArgsUnitTests.java index 1f33fb83d4..910461962b 100644 --- a/src/test/java/io/lettuce/core/protocol/CommandArgsUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/CommandArgsUnitTests.java @@ -181,4 +181,5 @@ void addKeyUsingByteCodec() { assertThat(buffer.toString(StandardCharsets.US_ASCII)).isEqualTo(expected.toString(StandardCharsets.US_ASCII)); } + } diff --git a/src/test/java/io/lettuce/core/protocol/CommandUnitTests.java b/src/test/java/io/lettuce/core/protocol/CommandUnitTests.java index 2ce36ce495..f40b5fac13 100644 --- a/src/test/java/io/lettuce/core/protocol/CommandUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/CommandUnitTests.java @@ -113,10 +113,12 @@ void getWithTimeout() { @Test void outputSubclassOverride1() { CommandOutput output = new CommandOutput(StringCodec.UTF8, null) { + @Override public String get() throws RedisException { return null; } + }; assertThatThrownBy(() -> output.set(null)).isInstanceOf(UnsupportedOperationException.class); } @@ -124,10 +126,12 @@ public String get() throws RedisException { @Test void outputSubclassOverride2() { CommandOutput output = new CommandOutput(StringCodec.UTF8, null) { + @Override public String get() throws RedisException { return null; } + }; assertThatThrownBy(() -> output.set(0)).isInstanceOf(UnsupportedOperationException.class); } @@ -139,11 +143,14 @@ void sillyTestsForEmmaCoverage() { } private enum MyKeywords implements ProtocolKeyword { + DUMMY; @Override public byte[] getBytes() { return name().getBytes(); } + } + } diff --git a/src/test/java/io/lettuce/core/protocol/CommandWrapperUnitTests.java b/src/test/java/io/lettuce/core/protocol/CommandWrapperUnitTests.java index 53372a3871..b25706a2d4 100644 --- a/src/test/java/io/lettuce/core/protocol/CommandWrapperUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/CommandWrapperUnitTests.java @@ -21,6 +21,7 @@ class CommandWrapperUnitTests { private RedisCodec codec = StringCodec.UTF8; + private Command sut; @BeforeEach @@ -114,4 +115,5 @@ void shouldPropagateCallbacksToDelegate() { assertThat(counter).hasValue(1); } + } diff --git a/src/test/java/io/lettuce/core/protocol/ConnectionFailureIntegrationTests.java b/src/test/java/io/lettuce/core/protocol/ConnectionFailureIntegrationTests.java index 92ef7364e2..38f759c371 100644 --- a/src/test/java/io/lettuce/core/protocol/ConnectionFailureIntegrationTests.java +++ b/src/test/java/io/lettuce/core/protocol/ConnectionFailureIntegrationTests.java @@ -45,6 +45,7 @@ class ConnectionFailureIntegrationTests extends TestSupport { private final RedisClient client; + private final RedisURI defaultRedisUri = RedisURI.Builder.redis(TestSettings.host(), TestSettings.port()).build(); @Inject @@ -132,8 +133,7 @@ void failOnReconnect() throws Exception { @Test void failOnReconnectShouldSendEvents() throws Exception { - client.setOptions( - ClientOptions.builder().suspendReconnectOnProtocolFailure(false).build()); + client.setOptions(ClientOptions.builder().suspendReconnectOnProtocolFailure(false).build()); RandomResponseServer ts = getRandomResponseServer(); @@ -181,8 +181,7 @@ void failOnReconnectShouldSendEvents() throws Exception { @Test void cancelCommandsOnReconnectFailure() throws Exception { - client.setOptions( - ClientOptions.builder().cancelCommandsOnReconnectFailure(true).build()); + client.setOptions(ClientOptions.builder().cancelCommandsOnReconnectFailure(true).build()); RandomResponseServer ts = getRandomResponseServer(); @@ -288,10 +287,12 @@ void pingOnConnectFailureShouldCloseConnection() throws Exception { AtomicReference ref = new AtomicReference<>(); ClientResources clientResources = ClientResources.builder().nettyCustomizer(new NettyCustomizer() { + @Override public void afterChannelInitialized(Channel channel) { ref.set(channel); } + }).build(); // Cluster node with auth @@ -318,10 +319,12 @@ void pingOnConnectFailureShouldCloseConnectionOnReconnect() throws Exception { BlockingQueue ref = new LinkedBlockingQueue<>(); ClientResources clientResources = ClientResources.builder().nettyCustomizer(new NettyCustomizer() { + @Override public void afterChannelInitialized(Channel channel) { ref.add(channel); } + }).build(); RedisURI redisUri = RedisURI.create(TestSettings.host(), TestSettings.port()); @@ -392,4 +395,5 @@ RandomResponseServer getRandomResponseServer() throws InterruptedException { ts.initialize(TestSettings.nonexistentPort()); return ts; } + } diff --git a/src/test/java/io/lettuce/core/protocol/DefaultEndpointUnitTests.java b/src/test/java/io/lettuce/core/protocol/DefaultEndpointUnitTests.java index 4a6422e026..8080848920 100644 --- a/src/test/java/io/lettuce/core/protocol/DefaultEndpointUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/DefaultEndpointUnitTests.java @@ -381,11 +381,9 @@ void shouldNotReplayActivationCommands() { when(channel.isActive()).thenReturn(true); ConnectionTestUtil.getDisconnectedBuffer(sut) - .add(new ActivationCommand<>( - new Command<>(CommandType.SELECT, new StatusOutput<>(StringCodec.UTF8)))); + .add(new ActivationCommand<>(new Command<>(CommandType.SELECT, new StatusOutput<>(StringCodec.UTF8)))); ConnectionTestUtil.getDisconnectedBuffer(sut).add(new LatencyMeteredCommand<>( - new ActivationCommand<>( - new Command<>(CommandType.SUBSCRIBE, new StatusOutput<>(StringCodec.UTF8))))); + new ActivationCommand<>(new Command<>(CommandType.SUBSCRIBE, new StatusOutput<>(StringCodec.UTF8))))); doAnswer(i -> { diff --git a/src/test/java/io/lettuce/core/protocol/RatioDecodeBufferPolicyTest.java b/src/test/java/io/lettuce/core/protocol/RatioDecodeBufferPolicyTest.java index 3654ea4815..b48a86dc45 100644 --- a/src/test/java/io/lettuce/core/protocol/RatioDecodeBufferPolicyTest.java +++ b/src/test/java/io/lettuce/core/protocol/RatioDecodeBufferPolicyTest.java @@ -67,4 +67,5 @@ void shouldDiscardReadBytesWhenReachedUsageRatio() { verify(buffer).readerIndex(); verify(buffer).discardReadBytes(); } + } diff --git a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp2UnitTests.java b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp2UnitTests.java index d05d7ff3bd..a31c20bea1 100644 --- a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp2UnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp2UnitTests.java @@ -53,8 +53,11 @@ class RedisStateMachineResp2UnitTests { private RedisCodec codec = StringCodec.UTF8; + private Charset charset = StandardCharsets.UTF_8; + private CommandOutput output; + private RedisStateMachine rsm; @BeforeAll @@ -196,4 +199,5 @@ void sillyTestsForEmmaCoverage() { ByteBuf buffer(String content) { return Unpooled.copiedBuffer(content, charset); } + } diff --git a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java index 3b7a356272..f00c27b8ba 100644 --- a/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/RedisStateMachineResp3UnitTests.java @@ -54,8 +54,11 @@ class RedisStateMachineResp3UnitTests { private RedisCodec codec = StringCodec.UTF8; + private Charset charset = StandardCharsets.UTF_8; + private CommandOutput output; + private RedisStateMachine rsm; @BeforeAll @@ -141,11 +144,9 @@ void booleanValue() { @Test void hello() { CommandOutput> output = new GenericMapOutput<>(codec); - assertThat( - rsm.decode(buffer("%7\r\n" + "$6\r\nserver\r\n$5\r\nredis\r\n" + "$7\r\nversion\r\n$11\r\n999.999.999\r\n" - + "$5\r\nproto\r\n:3\r\n" + "$2\r\nid\r\n:184\r\n" + "$4\r\nmode\r\n$10\r\nstandalone\r\n" - + "$4\r\nrole\r\n$6\r\nmaster\r\n" + "$7\r\nmodules\r\n*0\r\n"), - output)).isTrue(); + assertThat(rsm.decode(buffer("%7\r\n" + "$6\r\nserver\r\n$5\r\nredis\r\n" + "$7\r\nversion\r\n$11\r\n999.999.999\r\n" + + "$5\r\nproto\r\n:3\r\n" + "$2\r\nid\r\n:184\r\n" + "$4\r\nmode\r\n$10\r\nstandalone\r\n" + + "$4\r\nrole\r\n$6\r\nmaster\r\n" + "$7\r\nmodules\r\n*0\r\n"), output)).isTrue(); assertThat(output.get()).containsEntry("mode", "standalone"); } @@ -234,4 +235,5 @@ void sillyTestsForEmmaCoverage() { ByteBuf buffer(String content) { return Unpooled.copiedBuffer(content, charset); } + } diff --git a/src/test/java/io/lettuce/core/protocol/StateMachineUnitTests.java b/src/test/java/io/lettuce/core/protocol/StateMachineUnitTests.java index ff0164f567..54b3de051d 100644 --- a/src/test/java/io/lettuce/core/protocol/StateMachineUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/StateMachineUnitTests.java @@ -47,8 +47,11 @@ * @author Mark Paluch */ class StateMachineUnitTests { + private RedisCodec codec = StringCodec.UTF8; + private CommandOutput output; + private RedisStateMachine rsm; @BeforeAll @@ -189,4 +192,5 @@ void sillyTestsForEmmaCoverage() { ByteBuf buffer(String content) { return Unpooled.copiedBuffer(content, StandardCharsets.UTF_8); } + } diff --git a/src/test/java/io/lettuce/core/protocol/TransactionalCommandUnitTests.java b/src/test/java/io/lettuce/core/protocol/TransactionalCommandUnitTests.java index d6633a13ed..838d3498a7 100644 --- a/src/test/java/io/lettuce/core/protocol/TransactionalCommandUnitTests.java +++ b/src/test/java/io/lettuce/core/protocol/TransactionalCommandUnitTests.java @@ -24,4 +24,5 @@ void shouldCompleteOnException() { assertThat(command).isCompletedExceptionally(); } + } diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubCommandHandlerUnitTests.java b/src/test/java/io/lettuce/core/pubsub/PubSubCommandHandlerUnitTests.java index 6a7aeae260..871915adae 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubCommandHandlerUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubCommandHandlerUnitTests.java @@ -316,4 +316,5 @@ void shouldCompleteWithChunkedResponseInterleavedSending() throws Exception { private static ByteBuf responseBytes(String s) { return Unpooled.wrappedBuffer(s.getBytes()); } + } diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubEndpointUnitTests.java b/src/test/java/io/lettuce/core/pubsub/PubSubEndpointUnitTests.java index b3a3a143e0..bf109ee0bb 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubEndpointUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubEndpointUnitTests.java @@ -80,19 +80,23 @@ void listenerNotificationShouldFailGracefully() { AtomicInteger notified = new AtomicInteger(); sut.addListener(new RedisPubSubAdapter() { + @Override public void message(byte[] channel, byte[] message) { notified.incrementAndGet(); throw new UnsupportedOperationException(); } + }); sut.addListener(new RedisPubSubAdapter() { + @Override public void message(byte[] channel, byte[] message) { notified.incrementAndGet(); } + }); sut.notifyMessage(createMessage("message", "channel1", ByteArrayCodec.INSTANCE)); @@ -109,4 +113,5 @@ private static PubSubOutput createMessage(String action, String cha return output; } + } diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java index 2c93374fa9..e5d91a156e 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java @@ -287,6 +287,7 @@ void pubsubShardMultipleChannels() { @Test @EnabledOnCommand("SPUBLISH") void pubsubShardChannelsWithArg() { + StepVerifier.create(pubsub.ssubscribe(shardChannel)).verifyComplete(); Wait.untilTrue(() -> mono(pubsub2.pubsubShardChannels(shardChannel).filter(s -> shardChannel.equals(s))) != null) .waitOrTimeout(); diff --git a/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java b/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java index 8eebf685fa..65b0a960aa 100644 --- a/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java @@ -22,8 +22,10 @@ class RedisPubSubAsyncCommandsImplUnitTests { - private RedisPubSubAsyncCommandsImpl commands; + private RedisPubSubAsyncCommandsImpl commands; + private StatefulRedisPubSubConnection mockedConnection; + private final RedisCodec codec = StringCodec.UTF8; @BeforeEach @@ -35,12 +37,13 @@ void setup() { @Test void psubscribe() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.psubscribe(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PSUBSCRIBE); @@ -53,12 +56,13 @@ void psubscribe() throws ExecutionException, InterruptedException { @Test void punsubscribe() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.punsubscribe(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUNSUBSCRIBE); @@ -71,12 +75,13 @@ void punsubscribe() throws ExecutionException, InterruptedException { @Test void subscribe() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.subscribe(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(SUBSCRIBE); @@ -89,12 +94,13 @@ void subscribe() throws ExecutionException, InterruptedException { @Test void unsubscribe() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.unsubscribe(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(UNSUBSCRIBE); @@ -109,12 +115,13 @@ void publish() throws ExecutionException, InterruptedException { String channel = "acmeChannel"; String message = "acmeMessage"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.publish(channel, message).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUBLISH); @@ -128,12 +135,13 @@ void publish() throws ExecutionException, InterruptedException { void pubsubChannels() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.pubsubChannels(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUBSUB); @@ -147,12 +155,13 @@ void pubsubChannels() throws ExecutionException, InterruptedException { void pubsubNumsub() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.pubsubNumsub(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUBSUB); @@ -166,12 +175,13 @@ void pubsubNumsub() throws ExecutionException, InterruptedException { void pubsubShardChannels() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.pubsubShardChannels(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUBSUB); @@ -185,12 +195,13 @@ void pubsubShardChannels() throws ExecutionException, InterruptedException { void pubsubShardNumsub() throws ExecutionException, InterruptedException { String pattern = "channelPattern"; - AsyncCommand dispachedMock = mock (AsyncCommand.class); + AsyncCommand dispachedMock = mock(AsyncCommand.class); when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); commands.pubsubShardNumsub(pattern).get(); - ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class);; + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + ; verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(PUBSUB); @@ -209,7 +220,7 @@ void ssubscribe() throws ExecutionException, InterruptedException { commands.ssubscribe(pattern).get(); ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); - + verify(mockedConnection).dispatch(capturedCommand.capture()); assertThat(capturedCommand.getValue().getType()).isEqualTo(SSUBSCRIBE); @@ -218,4 +229,5 @@ void ssubscribe() throws ExecutionException, InterruptedException { assertNotEquals(capturedCommand.getValue(), dispachedMock); } + } diff --git a/src/test/java/io/lettuce/core/pubsub/StatefulRedisPubSubConnectionImplUnitTests.java b/src/test/java/io/lettuce/core/pubsub/StatefulRedisPubSubConnectionImplUnitTests.java index 08f6fea6f4..160a601125 100644 --- a/src/test/java/io/lettuce/core/pubsub/StatefulRedisPubSubConnectionImplUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/StatefulRedisPubSubConnectionImplUnitTests.java @@ -24,6 +24,7 @@ class StatefulRedisPubSubConnectionImplUnitTests { private StatefulRedisPubSubConnectionImpl connection; private final RedisCodec codec = StringCodec.UTF8; + private final Duration timeout = Duration.ofSeconds(5); PubSubEndpoint mockedEndpoint; @@ -44,7 +45,6 @@ void setup() { connection = new StatefulRedisPubSubConnectionImpl(mockedEndpoint, mockedWriter, codec, timeout); } - @Test void addListener() { RedisPubSubListener listener = mock(RedisPubSubListener.class); @@ -83,7 +83,7 @@ void resubscribeChannelSubscription() { RedisFuture commandFuture = subscriptions.get(0); assertEquals(1, subscriptions.size()); - assertInstanceOf( AsyncCommand.class, commandFuture); + assertInstanceOf(AsyncCommand.class, commandFuture); } @Test @@ -93,11 +93,11 @@ void resubscribeChannelAndPatternSubscription() { when(mockedEndpoint.hasPatternSubscriptions()).thenReturn(true); when(mockedEndpoint.getPatterns()).thenReturn(new HashSet<>(Arrays.asList(new String[] { "bcast*", "echo" }))); - List> subscriptions = connection.resubscribe(); assertEquals(2, subscriptions.size()); - assertInstanceOf( AsyncCommand.class, subscriptions.get(0)); - assertInstanceOf( AsyncCommand.class, subscriptions.get(1)); + assertInstanceOf(AsyncCommand.class, subscriptions.get(0)); + assertInstanceOf(AsyncCommand.class, subscriptions.get(1)); } + } diff --git a/src/test/java/io/lettuce/core/reactive/RedisPublisherVerification.java b/src/test/java/io/lettuce/core/reactive/RedisPublisherVerification.java index 88e0a4c625..a1b779aa00 100644 --- a/src/test/java/io/lettuce/core/reactive/RedisPublisherVerification.java +++ b/src/test/java/io/lettuce/core/reactive/RedisPublisherVerification.java @@ -33,6 +33,7 @@ public class RedisPublisherVerification extends PublisherVerification { private static RedisClient client; + private static StatefulRedisConnection connection; public RedisPublisherVerification() { diff --git a/src/test/java/io/lettuce/core/reactive/ScanStreamVerification.java b/src/test/java/io/lettuce/core/reactive/ScanStreamVerification.java index 37f7be1fd9..d182ed06c4 100644 --- a/src/test/java/io/lettuce/core/reactive/ScanStreamVerification.java +++ b/src/test/java/io/lettuce/core/reactive/ScanStreamVerification.java @@ -28,6 +28,7 @@ public class ScanStreamVerification extends PublisherVerification { private static final int ELEMENT_COUNT = 10000; private static RedisClient client; + private static StatefulRedisConnection connection; public ScanStreamVerification() { @@ -64,7 +65,7 @@ public Publisher createPublisher(long elements) { String element = "ScanStreamVerification-" + i; map.put(element, element); - if (i % 1000-2020 == 0 && !map.isEmpty()) { + if (i % 1000 - 2020 == 0 && !map.isEmpty()) { sync.mset(map); map.clear(); } diff --git a/src/test/java/io/lettuce/core/reliability/AtLeastOnceTest.java b/src/test/java/io/lettuce/core/reliability/AtLeastOnceTest.java index 68e96ae0aa..b290075057 100644 --- a/src/test/java/io/lettuce/core/reliability/AtLeastOnceTest.java +++ b/src/test/java/io/lettuce/core/reliability/AtLeastOnceTest.java @@ -128,8 +128,8 @@ void commandFailsWhenFailOnEncode() { RedisCommands verificationConnection = client.connect().sync(); connection.set(key, "1"); - AsyncCommand working = new AsyncCommand<>(new Command<>(CommandType.INCR, new IntegerOutput( - StringCodec.UTF8), new CommandArgs<>(StringCodec.UTF8).addKey(key))); + AsyncCommand working = new AsyncCommand<>(new Command<>(CommandType.INCR, + new IntegerOutput(StringCodec.UTF8), new CommandArgs<>(StringCodec.UTF8).addKey(key))); channelWriter.write(working); assertThat(working.await(2, TimeUnit.SECONDS)).isTrue(); assertThat(connection.get(key)).isEqualTo("2"); @@ -141,6 +141,7 @@ void commandFailsWhenFailOnEncode() { public void encode(ByteBuf buf) { throw new IllegalStateException("I want to break free"); } + }; channelWriter.write(command); @@ -258,6 +259,7 @@ public void encode(ByteBuf buf) { } super.encode(buf); } + }; } @@ -270,8 +272,8 @@ void commandFailsDuringDecode() { connection.set(key, "1"); - AsyncCommand command = new AsyncCommand(new Command<>(CommandType.INCR, new StatusOutput<>( - StringCodec.UTF8), new CommandArgs<>(StringCodec.UTF8).addKey(key))); + AsyncCommand command = new AsyncCommand(new Command<>(CommandType.INCR, + new StatusOutput<>(StringCodec.UTF8), new CommandArgs<>(StringCodec.UTF8).addKey(key))); channelWriter.write(command); diff --git a/src/test/java/io/lettuce/core/reliability/AtMostOnceTest.java b/src/test/java/io/lettuce/core/reliability/AtMostOnceTest.java index 9414ed5836..7963d5a98e 100644 --- a/src/test/java/io/lettuce/core/reliability/AtMostOnceTest.java +++ b/src/test/java/io/lettuce/core/reliability/AtMostOnceTest.java @@ -143,6 +143,7 @@ void commandNotExecutedFailsOnEncode() { public void encode(ByteBuf buf) { throw new IllegalStateException("I want to break free"); } + }; channelWriter.write(command); @@ -190,6 +191,7 @@ public void encode(ByteBuf buf) { } super.encode(buf); } + }; channelWriter.write(command); @@ -304,4 +306,5 @@ private Throwable getException(RedisFuture command) { } return null; } + } diff --git a/src/test/java/io/lettuce/core/resource/ConstantDelayUnitTests.java b/src/test/java/io/lettuce/core/resource/ConstantDelayUnitTests.java index 263aa9370c..7a171b4891 100644 --- a/src/test/java/io/lettuce/core/resource/ConstantDelayUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/ConstantDelayUnitTests.java @@ -35,4 +35,5 @@ void shouldCreateConstantDelay() { assertThat(delay.createDelay(0)).isEqualTo(Duration.ofMillis(100)); assertThat(delay.createDelay(5)).isEqualTo(Duration.ofMillis(100)); } + } diff --git a/src/test/java/io/lettuce/core/resource/DecorrelatedJitterDelayUnitTests.java b/src/test/java/io/lettuce/core/resource/DecorrelatedJitterDelayUnitTests.java index 7677d790bb..3c0d3faf0e 100644 --- a/src/test/java/io/lettuce/core/resource/DecorrelatedJitterDelayUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/DecorrelatedJitterDelayUnitTests.java @@ -35,14 +35,14 @@ class DecorrelatedJitterDelayUnitTests { @Test void shouldNotCreateIfLowerBoundIsNegative() { - assertThatThrownBy(() -> Delay.decorrelatedJitter(-1, 100, 0, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.decorrelatedJitter(-1, 100, 0, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldNotCreateIfLowerBoundIsSameAsUpperBound() { - assertThatThrownBy(() -> Delay.decorrelatedJitter(100, 100, 1, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.decorrelatedJitter(100, 100, 1, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -81,4 +81,5 @@ void testDefaultDelays() { assertThat(delay.createDelay(Integer.MAX_VALUE).toMillis()).isBetween(0L, 30000L); } } + } diff --git a/src/test/java/io/lettuce/core/resource/DefaultEventLoopGroupProviderUnitTests.java b/src/test/java/io/lettuce/core/resource/DefaultEventLoopGroupProviderUnitTests.java index 8f3d530d7e..cd274cb681 100644 --- a/src/test/java/io/lettuce/core/resource/DefaultEventLoopGroupProviderUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/DefaultEventLoopGroupProviderUnitTests.java @@ -36,4 +36,5 @@ void getAfterShutdown() { TestFutures.awaitOrTimeout(sut.shutdown(10, 10, TimeUnit.MILLISECONDS)); assertThatThrownBy(() -> sut.allocate(NioEventLoopGroup.class)).isInstanceOf(IllegalStateException.class); } + } diff --git a/src/test/java/io/lettuce/core/resource/DirContextDnsResolverTests.java b/src/test/java/io/lettuce/core/resource/DirContextDnsResolverTests.java index 6618f56af4..412ebaa28b 100644 --- a/src/test/java/io/lettuce/core/resource/DirContextDnsResolverTests.java +++ b/src/test/java/io/lettuce/core/resource/DirContextDnsResolverTests.java @@ -177,4 +177,5 @@ void shouldWorkWithIpv6Addresses() throws Exception { assertThat(resolved[0]).isInstanceOf(Inet6Address.class); assertThat(resolved[0].getHostAddress()).isEqualTo("2a00:1450:4001:816:0:0:0:200e"); } + } diff --git a/src/test/java/io/lettuce/core/resource/EqualJitterDelayUnitTests.java b/src/test/java/io/lettuce/core/resource/EqualJitterDelayUnitTests.java index 2df3c480aa..12885548e9 100644 --- a/src/test/java/io/lettuce/core/resource/EqualJitterDelayUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/EqualJitterDelayUnitTests.java @@ -35,14 +35,14 @@ class EqualJitterDelayUnitTests { @Test void shouldNotCreateIfLowerBoundIsNegative() { - assertThatThrownBy(() -> Delay.equalJitter(-1, 100, 1, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.equalJitter(-1, 100, 1, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldNotCreateIfLowerBoundIsSameAsUpperBound() { - assertThatThrownBy(() -> Delay.equalJitter(100, 100, 1, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.equalJitter(100, 100, 1, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -85,4 +85,5 @@ void testDefaultDelays() { assertThat(delay.createDelay(17).toMillis()).isBetween(0L, 30000L); assertThat(delay.createDelay(Integer.MAX_VALUE).toMillis()).isBetween(0L, 30000L); } + } diff --git a/src/test/java/io/lettuce/core/resource/ExponentialDelayUnitTests.java b/src/test/java/io/lettuce/core/resource/ExponentialDelayUnitTests.java index 5449234b49..9a4b6dfe9b 100644 --- a/src/test/java/io/lettuce/core/resource/ExponentialDelayUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/ExponentialDelayUnitTests.java @@ -14,20 +14,20 @@ class ExponentialDelayUnitTests { @Test void shouldNotCreateIfLowerBoundIsNegative() { - assertThatThrownBy(() -> Delay.exponential(-1, 100, TimeUnit.MILLISECONDS, 10)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.exponential(-1, 100, TimeUnit.MILLISECONDS, 10)) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldNotCreateIfLowerBoundIsSameAsUpperBound() { - assertThatThrownBy(() -> Delay.exponential(100, 100, TimeUnit.MILLISECONDS, 10)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.exponential(100, 100, TimeUnit.MILLISECONDS, 10)) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldNotCreateIfPowerIsOne() { - assertThatThrownBy(() -> Delay.exponential(100, 1000, TimeUnit.MILLISECONDS, 1)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.exponential(100, 1000, TimeUnit.MILLISECONDS, 1)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -83,4 +83,5 @@ void testPow10Delays() { assertThat(delay.createDelay(5).toMillis()).isEqualTo(10000); assertThat(delay.createDelay(Integer.MAX_VALUE).toMillis()).isEqualTo(10000); } + } diff --git a/src/test/java/io/lettuce/core/resource/FullJitterDelayUnitTests.java b/src/test/java/io/lettuce/core/resource/FullJitterDelayUnitTests.java index ffdf19609d..440b4f219d 100644 --- a/src/test/java/io/lettuce/core/resource/FullJitterDelayUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/FullJitterDelayUnitTests.java @@ -35,14 +35,14 @@ class FullJitterDelayUnitTests { @Test void shouldNotCreateIfLowerBoundIsNegative() { - assertThatThrownBy(() -> Delay.fullJitter(-1, 100, 1, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.fullJitter(-1, 100, 1, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test void shouldNotCreateIfLowerBoundIsSameAsUpperBound() { - assertThatThrownBy(() -> Delay.fullJitter(100, 100, 1, TimeUnit.MILLISECONDS)).isInstanceOf( - IllegalArgumentException.class); + assertThatThrownBy(() -> Delay.fullJitter(100, 100, 1, TimeUnit.MILLISECONDS)) + .isInstanceOf(IllegalArgumentException.class); } @Test @@ -85,4 +85,5 @@ void testDefaultDelays() { assertThat(delay.createDelay(17).toMillis()).isBetween(15000L, 30000L); assertThat(delay.createDelay(Integer.MAX_VALUE).toMillis()).isBetween(15000L, 30000L); } + } diff --git a/src/test/java/io/lettuce/core/resource/MappingSocketAddressResolverUnitTests.java b/src/test/java/io/lettuce/core/resource/MappingSocketAddressResolverUnitTests.java index 8657cd2983..50c79ed570 100644 --- a/src/test/java/io/lettuce/core/resource/MappingSocketAddressResolverUnitTests.java +++ b/src/test/java/io/lettuce/core/resource/MappingSocketAddressResolverUnitTests.java @@ -59,4 +59,5 @@ void shouldMapHostAndPort() { assertThat(resolve.getPort()).isEqualTo(RedisURI.DEFAULT_REDIS_PORT + 100); assertThat(resolve.getHostString()).isEqualTo("localhost-foo"); } + } diff --git a/src/test/java/io/lettuce/core/sentinel/SentinelCommandIntegrationTests.java b/src/test/java/io/lettuce/core/sentinel/SentinelCommandIntegrationTests.java index e71ec2133e..4dc95d7c58 100644 --- a/src/test/java/io/lettuce/core/sentinel/SentinelCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/sentinel/SentinelCommandIntegrationTests.java @@ -35,7 +35,9 @@ public class SentinelCommandIntegrationTests extends TestSupport { private final RedisClient redisClient; + private StatefulRedisSentinelConnection connection; + private RedisSentinelCommands sentinel; @Inject @@ -50,7 +52,8 @@ void before() { this.sentinel = getSyncConnection(this.connection); } - protected RedisSentinelCommands getSyncConnection(StatefulRedisSentinelConnection connection) { + protected RedisSentinelCommands getSyncConnection( + StatefulRedisSentinelConnection connection) { return connection.sync(); } @@ -206,4 +209,5 @@ void set() { String result = sentinel.set(SentinelTestSettings.MASTER_ID, "down-after-milliseconds", "1000"); assertThat(result).isEqualTo("OK"); } + } diff --git a/src/test/java/io/lettuce/core/sentinel/SentinelConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/sentinel/SentinelConnectionIntegrationTests.java index a0f5bab26a..9f269fe9be 100644 --- a/src/test/java/io/lettuce/core/sentinel/SentinelConnectionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/sentinel/SentinelConnectionIntegrationTests.java @@ -32,8 +32,11 @@ public class SentinelConnectionIntegrationTests extends TestSupport { private final RedisClient redisClient; + private StatefulRedisSentinelConnection connection; + private RedisSentinelCommands sentinel; + private RedisSentinelAsyncCommands sentinelAsync; @Inject @@ -49,7 +52,8 @@ void before() { this.sentinelAsync = this.connection.async(); } - protected RedisSentinelCommands getSyncConnection(StatefulRedisSentinelConnection connection) { + protected RedisSentinelCommands getSyncConnection( + StatefulRedisSentinelConnection connection) { return connection.sync(); } @@ -140,8 +144,8 @@ void connectToOneNode() { @Test void connectWithByteCodec() { - RedisSentinelCommands connection = redisClient.connectSentinel(new ByteArrayCodec(), - SentinelTestSettings.SENTINEL_URI).sync(); + RedisSentinelCommands connection = redisClient + .connectSentinel(new ByteArrayCodec(), SentinelTestSettings.SENTINEL_URI).sync(); assertThat(connection.master(SentinelTestSettings.MASTER_ID.getBytes())).isNotNull(); connection.getStatefulConnection().close(); } diff --git a/src/test/java/io/lettuce/core/sentinel/SentinelServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/sentinel/SentinelServerCommandIntegrationTests.java index a4bef94e69..e67abc5cfc 100644 --- a/src/test/java/io/lettuce/core/sentinel/SentinelServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/sentinel/SentinelServerCommandIntegrationTests.java @@ -49,7 +49,9 @@ public class SentinelServerCommandIntegrationTests extends TestSupport { private final RedisClient redisClient; + private StatefulRedisSentinelConnection connection; + private RedisSentinelCommands sentinel; @Inject diff --git a/src/test/java/io/lettuce/core/sentinel/SentinelSslIntegrationTests.java b/src/test/java/io/lettuce/core/sentinel/SentinelSslIntegrationTests.java index a4baa6a6f5..7adc3221bc 100644 --- a/src/test/java/io/lettuce/core/sentinel/SentinelSslIntegrationTests.java +++ b/src/test/java/io/lettuce/core/sentinel/SentinelSslIntegrationTests.java @@ -83,4 +83,5 @@ void shouldConnectToMasterUsingSentinel() { connection.close(); FastShutdown.shutdown(client); } + } diff --git a/src/test/java/io/lettuce/core/sentinel/SentinelTestSettings.java b/src/test/java/io/lettuce/core/sentinel/SentinelTestSettings.java index 2f9bb41829..5dd9383cba 100644 --- a/src/test/java/io/lettuce/core/sentinel/SentinelTestSettings.java +++ b/src/test/java/io/lettuce/core/sentinel/SentinelTestSettings.java @@ -11,8 +11,10 @@ public abstract class SentinelTestSettings extends TestSupport { public static final RedisURI SENTINEL_URI = RedisURI.Builder.sentinel(TestSettings.host(), SentinelTestSettings.MASTER_ID) .build(); + public static final String MASTER_ID = "mymaster"; private SentinelTestSettings() { } + } diff --git a/src/test/java/io/lettuce/core/sentinel/reactive/SentinelReactiveCommandTest.java b/src/test/java/io/lettuce/core/sentinel/reactive/SentinelReactiveCommandTest.java index b843a78ac0..03ecca13c9 100644 --- a/src/test/java/io/lettuce/core/sentinel/reactive/SentinelReactiveCommandTest.java +++ b/src/test/java/io/lettuce/core/sentinel/reactive/SentinelReactiveCommandTest.java @@ -20,7 +20,9 @@ public SentinelReactiveCommandTest(RedisClient redisClient) { } @Override - protected RedisSentinelCommands getSyncConnection(StatefulRedisSentinelConnection connection) { + protected RedisSentinelCommands getSyncConnection( + StatefulRedisSentinelConnection connection) { return ReactiveSyncInvocationHandler.sync(connection); } + } diff --git a/src/test/java/io/lettuce/core/sentinel/reactive/SentinelServerReactiveCommandTest.java b/src/test/java/io/lettuce/core/sentinel/reactive/SentinelServerReactiveCommandTest.java index 72b3b68de3..759ce65bca 100644 --- a/src/test/java/io/lettuce/core/sentinel/reactive/SentinelServerReactiveCommandTest.java +++ b/src/test/java/io/lettuce/core/sentinel/reactive/SentinelServerReactiveCommandTest.java @@ -23,4 +23,5 @@ protected RedisSentinelCommands getSyncConnection( StatefulRedisSentinelConnection connection) { return ReactiveSyncInvocationHandler.sync(connection); } + } diff --git a/src/test/java/io/lettuce/core/support/AsyncConnectionPoolSupportIntegrationTests.java b/src/test/java/io/lettuce/core/support/AsyncConnectionPoolSupportIntegrationTests.java index 50f4991255..798d16c4b5 100644 --- a/src/test/java/io/lettuce/core/support/AsyncConnectionPoolSupportIntegrationTests.java +++ b/src/test/java/io/lettuce/core/support/AsyncConnectionPoolSupportIntegrationTests.java @@ -33,7 +33,9 @@ class AsyncConnectionPoolSupportIntegrationTests extends TestSupport { private static RedisClient client; + private static Set channels; + private static RedisURI uri = RedisURI.Builder.redis(host, port).build(); @BeforeAll @@ -53,8 +55,8 @@ static void afterClass() { @Test void asyncPoolShouldWorkWithWrappedConnections() { - BoundedAsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); + BoundedAsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); borrowAndReturn(pool); borrowAndClose(pool); @@ -122,8 +124,8 @@ void asyncPoolShouldCloseConnectionsAboveMaxIdleSize() { @Test void asyncPoolShouldWorkWithPlainConnections() { - AsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create(), false); + AsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create(), false); borrowAndReturn(pool); @@ -137,8 +139,8 @@ void asyncPoolShouldWorkWithPlainConnections() { @Test void asyncPoolUsingWrappingShouldPropagateExceptionsCorrectly() { - AsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); + AsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); StatefulRedisConnection connection = TestFutures.getOrTimeout(pool.acquire()); RedisCommands sync = connection.sync(); @@ -158,20 +160,20 @@ void asyncPoolUsingWrappingShouldPropagateExceptionsCorrectly() { @Test void wrappedConnectionShouldUseWrappers() { - AsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); + AsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); StatefulRedisConnection connection = TestFutures.getOrTimeout(pool.acquire()); RedisCommands sync = connection.sync(); - assertThat(connection).isInstanceOf(StatefulRedisConnection.class).isNotInstanceOf( - StatefulRedisClusterConnectionImpl.class); + assertThat(connection).isInstanceOf(StatefulRedisConnection.class) + .isNotInstanceOf(StatefulRedisClusterConnectionImpl.class); assertThat(Proxy.isProxyClass(connection.getClass())).isTrue(); assertThat(sync).isInstanceOf(RedisCommands.class); assertThat(connection.async()).isInstanceOf(RedisAsyncCommands.class).isNotInstanceOf(RedisAsyncCommandsImpl.class); - assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class).isNotInstanceOf( - RedisReactiveCommandsImpl.class); + assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class) + .isNotInstanceOf(RedisReactiveCommandsImpl.class); assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisConnection.class) .isNotInstanceOf(StatefulRedisConnectionImpl.class).isSameAs(connection); @@ -182,8 +184,8 @@ void wrappedConnectionShouldUseWrappers() { @Test void wrappedObjectClosedAfterReturn() { - AsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create(), true); + AsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create(), true); StatefulRedisConnection connection = TestFutures.getOrTimeout(pool.acquire()); RedisCommands sync = connection.sync(); @@ -204,8 +206,8 @@ void wrappedObjectClosedAfterReturn() { @Test void shouldPropagateAsyncFlow() { - AsyncPool> pool = AsyncConnectionPoolSupport.createBoundedObjectPool( - () -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); + AsyncPool> pool = AsyncConnectionPoolSupport + .createBoundedObjectPool(() -> client.connectAsync(StringCodec.ASCII, uri), BoundedPoolConfig.create()); CompletableFuture pingResponse = pool.acquire().thenCompose(c -> { return c.async().ping().whenComplete((s, throwable) -> pool.release(c)); @@ -246,4 +248,5 @@ private void borrowAndCloseAsync(AsyncPool pool = new BoundedAsyncPool<>(factory, BoundedPoolConfig.builder().maxTotal(20).minIdle(5) - .build()); + BoundedAsyncPool pool = new BoundedAsyncPool<>(factory, + BoundedPoolConfig.builder().maxTotal(20).minIdle(5).build()); assertThat(pool.getIdle()).isEqualTo(5); @@ -322,8 +322,8 @@ void shouldDisposeIdleObjects() { mockCreation(); - BoundedAsyncPool pool = new BoundedAsyncPool<>(factory, BoundedPoolConfig.builder().maxTotal(20).maxIdle(5) - .minIdle(5).build()); + BoundedAsyncPool pool = new BoundedAsyncPool<>(factory, + BoundedPoolConfig.builder().maxTotal(20).maxIdle(5).minIdle(5).build()); assertThat(pool.getIdle()).isEqualTo(5); @@ -334,4 +334,5 @@ void shouldDisposeIdleObjects() { verify(factory).destroy(object); } + } diff --git a/src/test/java/io/lettuce/core/support/CdiIntegrationTests.java b/src/test/java/io/lettuce/core/support/CdiIntegrationTests.java index d26e5220c5..9edefdb1c0 100644 --- a/src/test/java/io/lettuce/core/support/CdiIntegrationTests.java +++ b/src/test/java/io/lettuce/core/support/CdiIntegrationTests.java @@ -83,4 +83,5 @@ void testInjection() { injectedClient.pingRedis(); } + } diff --git a/src/test/java/io/lettuce/core/support/CommonsPool2ConfigConverterUnitTests.java b/src/test/java/io/lettuce/core/support/CommonsPool2ConfigConverterUnitTests.java index 2d13294312..757156e7d7 100644 --- a/src/test/java/io/lettuce/core/support/CommonsPool2ConfigConverterUnitTests.java +++ b/src/test/java/io/lettuce/core/support/CommonsPool2ConfigConverterUnitTests.java @@ -81,4 +81,5 @@ static void booleanTester(boolean value, BiConsumer, assertThat(targetExtractor.apply(result)).isEqualTo(value); } + } diff --git a/src/test/java/io/lettuce/core/support/ConnectionPoolSupportIntegrationTests.java b/src/test/java/io/lettuce/core/support/ConnectionPoolSupportIntegrationTests.java index 2932f55d14..05b98024c8 100644 --- a/src/test/java/io/lettuce/core/support/ConnectionPoolSupportIntegrationTests.java +++ b/src/test/java/io/lettuce/core/support/ConnectionPoolSupportIntegrationTests.java @@ -43,6 +43,7 @@ class ConnectionPoolSupportIntegrationTests extends TestSupport { private static RedisClient client; + private static Set channels; @BeforeAll @@ -61,8 +62,8 @@ static void afterClass() { @Test void genericPoolShouldWorkWithWrappedConnections() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>()); borrowAndReturn(pool); borrowAndClose(pool); @@ -86,8 +87,8 @@ void genericPoolShouldCloseConnectionsAboveMaxIdleSize() throws Exception { GenericObjectPoolConfig> poolConfig = new GenericObjectPoolConfig<>(); poolConfig.setMaxIdle(2); - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), poolConfig); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), poolConfig); borrowAndReturn(pool); borrowAndClose(pool); @@ -115,8 +116,8 @@ void genericPoolShouldCloseConnectionsAboveMaxIdleSize() throws Exception { @Test void genericPoolShouldWorkWithPlainConnections() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>(), false); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>(), false); borrowAndReturn(pool); @@ -146,8 +147,8 @@ void softReferencePoolShouldWorkWithPlainConnections() throws Exception { @Test void genericPoolUsingWrappingShouldPropagateExceptionsCorrectly() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>()); StatefulRedisConnection connection = pool.borrowObject(); RedisCommands sync = connection.sync(); @@ -167,20 +168,20 @@ void genericPoolUsingWrappingShouldPropagateExceptionsCorrectly() throws Excepti @Test void wrappedConnectionShouldUseWrappers() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>()); StatefulRedisConnection connection = pool.borrowObject(); RedisCommands sync = connection.sync(); - assertThat(connection).isInstanceOf(StatefulRedisConnection.class).isNotInstanceOf( - StatefulRedisClusterConnectionImpl.class); + assertThat(connection).isInstanceOf(StatefulRedisConnection.class) + .isNotInstanceOf(StatefulRedisClusterConnectionImpl.class); assertThat(Proxy.isProxyClass(connection.getClass())).isTrue(); assertThat(sync).isInstanceOf(RedisCommands.class); assertThat(connection.async()).isInstanceOf(RedisAsyncCommands.class).isNotInstanceOf(RedisAsyncCommandsImpl.class); - assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class).isNotInstanceOf( - RedisReactiveCommandsImpl.class); + assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class) + .isNotInstanceOf(RedisReactiveCommandsImpl.class); assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisConnection.class) .isNotInstanceOf(StatefulRedisConnectionImpl.class).isSameAs(connection); @@ -203,8 +204,8 @@ void wrappedMasterSlaveConnectionShouldUseWrappers() throws Exception { assertThat(sync).isInstanceOf(RedisCommands.class); assertThat(connection.async()).isInstanceOf(RedisAsyncCommands.class).isNotInstanceOf(RedisAsyncCommandsImpl.class); - assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class).isNotInstanceOf( - RedisReactiveCommandsImpl.class); + assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class) + .isNotInstanceOf(RedisReactiveCommandsImpl.class); assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisConnection.class) .isNotInstanceOf(StatefulRedisConnectionImpl.class).isSameAs(connection); @@ -218,21 +219,21 @@ void wrappedClusterConnectionShouldUseWrappers() throws Exception { RedisClusterClient redisClusterClient = RedisClusterClient.create(TestClientResources.get(), RedisURI.create(TestSettings.host(), 7379)); - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - redisClusterClient::connect, new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(redisClusterClient::connect, new GenericObjectPoolConfig<>()); StatefulRedisClusterConnection connection = pool.borrowObject(); RedisAdvancedClusterCommands sync = connection.sync(); - assertThat(connection).isInstanceOf(StatefulRedisClusterConnection.class).isNotInstanceOf( - StatefulRedisClusterConnectionImpl.class); + assertThat(connection).isInstanceOf(StatefulRedisClusterConnection.class) + .isNotInstanceOf(StatefulRedisClusterConnectionImpl.class); assertThat(Proxy.isProxyClass(connection.getClass())).isTrue(); assertThat(sync).isInstanceOf(RedisAdvancedClusterCommands.class); - assertThat(connection.async()).isInstanceOf(RedisAdvancedClusterAsyncCommands.class).isNotInstanceOf( - RedisAdvancedClusterAsyncCommandsImpl.class); - assertThat(connection.reactive()).isInstanceOf(RedisAdvancedClusterReactiveCommands.class).isNotInstanceOf( - RedisAdvancedClusterReactiveCommandsImpl.class); + assertThat(connection.async()).isInstanceOf(RedisAdvancedClusterAsyncCommands.class) + .isNotInstanceOf(RedisAdvancedClusterAsyncCommandsImpl.class); + assertThat(connection.reactive()).isInstanceOf(RedisAdvancedClusterReactiveCommands.class) + .isNotInstanceOf(RedisAdvancedClusterReactiveCommandsImpl.class); assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisClusterConnection.class) .isNotInstanceOf(StatefulRedisClusterConnectionImpl.class).isSameAs(connection); @@ -245,22 +246,22 @@ void wrappedClusterConnectionShouldUseWrappers() throws Exception { @Test void plainConnectionShouldNotUseWrappers() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>(), false); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>(), false); StatefulRedisConnection connection = pool.borrowObject(); RedisCommands sync = connection.sync(); - assertThat(connection).isInstanceOf(StatefulRedisConnection.class).isNotInstanceOf( - StatefulRedisClusterConnectionImpl.class); + assertThat(connection).isInstanceOf(StatefulRedisConnection.class) + .isNotInstanceOf(StatefulRedisClusterConnectionImpl.class); assertThat(Proxy.isProxyClass(connection.getClass())).isFalse(); assertThat(sync).isInstanceOf(RedisCommands.class); assertThat(connection.async()).isInstanceOf(RedisAsyncCommands.class).isInstanceOf(RedisAsyncCommandsImpl.class); - assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class).isInstanceOf( - RedisReactiveCommandsImpl.class); - assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisConnection.class).isInstanceOf( - StatefulRedisConnectionImpl.class); + assertThat(connection.reactive()).isInstanceOf(RedisReactiveCommands.class) + .isInstanceOf(RedisReactiveCommandsImpl.class); + assertThat(sync.getStatefulConnection()).isInstanceOf(StatefulRedisConnection.class) + .isInstanceOf(StatefulRedisConnectionImpl.class); pool.returnObject(connection); pool.close(); @@ -290,8 +291,8 @@ void softRefPoolShouldWorkWithWrappedConnections() throws Exception { @Test void wrappedObjectClosedAfterReturn() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>(), true); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>(), true); StatefulRedisConnection connection = pool.borrowObject(); RedisCommands sync = connection.sync(); @@ -312,8 +313,8 @@ void wrappedObjectClosedAfterReturn() throws Exception { @Test void tryWithResourcesReturnsConnectionToPool() throws Exception { - GenericObjectPool> pool = ConnectionPoolSupport.createGenericObjectPool( - () -> client.connect(), new GenericObjectPoolConfig<>()); + GenericObjectPool> pool = ConnectionPoolSupport + .createGenericObjectPool(() -> client.connect(), new GenericObjectPoolConfig<>()); StatefulRedisConnection usedConnection = null; try (StatefulRedisConnection connection = pool.borrowObject()) { @@ -388,4 +389,5 @@ private void borrowAndClose(ObjectPool> connection.close(); } } + } diff --git a/src/test/java/io/lettuce/core/support/InjectedClient.java b/src/test/java/io/lettuce/core/support/InjectedClient.java index 3d96246c4b..035d9d4bef 100644 --- a/src/test/java/io/lettuce/core/support/InjectedClient.java +++ b/src/test/java/io/lettuce/core/support/InjectedClient.java @@ -45,4 +45,5 @@ public void preDestroy() { connection.getStatefulConnection().close(); } } + } diff --git a/src/test/java/io/lettuce/core/support/caching/ClientsideCachingIntegrationTests.java b/src/test/java/io/lettuce/core/support/caching/ClientsideCachingIntegrationTests.java index a6650c9a67..bb598e5ea7 100644 --- a/src/test/java/io/lettuce/core/support/caching/ClientsideCachingIntegrationTests.java +++ b/src/test/java/io/lettuce/core/support/caching/ClientsideCachingIntegrationTests.java @@ -68,12 +68,14 @@ void clientCachingResp2() { commands.clientTracking(TrackingArgs.Builder.enabled().redirect(pubSub.sync().clientId())); pubSub.addListener(new RedisPubSubAdapter() { + @Override public void message(String channel, String message) { if (channel.equals("__redis__:invalidate")) { invalidations.add(message); } } + }); pubSub.sync().subscribe("__redis__:invalidate"); diff --git a/src/test/java/io/lettuce/core/tracing/BraveTracingUnitTests.java b/src/test/java/io/lettuce/core/tracing/BraveTracingUnitTests.java index 90bf1e6f28..5940314e51 100644 --- a/src/test/java/io/lettuce/core/tracing/BraveTracingUnitTests.java +++ b/src/test/java/io/lettuce/core/tracing/BraveTracingUnitTests.java @@ -33,6 +33,7 @@ class BraveTracingUnitTests extends TestSupport { private static Tracing clientTracing; + private static Queue spans = new LinkedBlockingQueue<>(); @BeforeAll @@ -89,8 +90,8 @@ void shouldReportCustomServiceName() { @Test void shouldCustomizeEndpoint() { - BraveTracing tracing = BraveTracing.builder().tracing(clientTracing) - .endpointCustomizer(it -> it.serviceName("foo-bar")).build(); + BraveTracing tracing = BraveTracing.builder().tracing(clientTracing).endpointCustomizer(it -> it.serviceName("foo-bar")) + .build(); BraveTracing.BraveEndpoint endpoint = (BraveTracing.BraveEndpoint) tracing .createEndpoint(new DomainSocketAddress("foo")); @@ -111,4 +112,5 @@ void shouldCustomizeSpan() { assertThat(tags).contains("cmd", "AUTH"); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToElastiCacheMaster.java b/src/test/java/io/lettuce/examples/ConnectToElastiCacheMaster.java index 18df596c51..c587aff1d5 100644 --- a/src/test/java/io/lettuce/examples/ConnectToElastiCacheMaster.java +++ b/src/test/java/io/lettuce/examples/ConnectToElastiCacheMaster.java @@ -26,4 +26,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingElastiCacheCluster.java b/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingElastiCacheCluster.java index 2d15b4d54e..32303bdfaa 100644 --- a/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingElastiCacheCluster.java +++ b/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingElastiCacheCluster.java @@ -32,4 +32,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingRedisSentinel.java b/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingRedisSentinel.java index fea0941ed7..d08200e224 100644 --- a/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingRedisSentinel.java +++ b/src/test/java/io/lettuce/examples/ConnectToMasterSlaveUsingRedisSentinel.java @@ -25,4 +25,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedis.java b/src/test/java/io/lettuce/examples/ConnectToRedis.java index 5ae347792d..84c7920de6 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedis.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedis.java @@ -40,4 +40,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedisCluster.java b/src/test/java/io/lettuce/examples/ConnectToRedisCluster.java index fba7f2efd7..6ae86d8772 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedisCluster.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedisCluster.java @@ -41,4 +41,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedisClusterSSL.java b/src/test/java/io/lettuce/examples/ConnectToRedisClusterSSL.java index 63f3543359..693ec6cec4 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedisClusterSSL.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedisClusterSSL.java @@ -23,4 +23,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedisClusterWithTopologyRefreshing.java b/src/test/java/io/lettuce/examples/ConnectToRedisClusterWithTopologyRefreshing.java index bfcdfc3174..13a78aea83 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedisClusterWithTopologyRefreshing.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedisClusterWithTopologyRefreshing.java @@ -35,4 +35,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedisSSL.java b/src/test/java/io/lettuce/examples/ConnectToRedisSSL.java index fa7f780b9a..28b0ce059f 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedisSSL.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedisSSL.java @@ -21,4 +21,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ConnectToRedisUsingRedisSentinel.java b/src/test/java/io/lettuce/examples/ConnectToRedisUsingRedisSentinel.java index 2e4a8edcec..24a032e925 100644 --- a/src/test/java/io/lettuce/examples/ConnectToRedisUsingRedisSentinel.java +++ b/src/test/java/io/lettuce/examples/ConnectToRedisUsingRedisSentinel.java @@ -20,4 +20,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/examples/ReadWriteExample.java b/src/test/java/io/lettuce/examples/ReadWriteExample.java index 3c4f3d8d37..f9a2c28470 100644 --- a/src/test/java/io/lettuce/examples/ReadWriteExample.java +++ b/src/test/java/io/lettuce/examples/ReadWriteExample.java @@ -28,4 +28,5 @@ public static void main(String[] args) { connection.close(); redisClient.shutdown(); } + } diff --git a/src/test/java/io/lettuce/test/CanConnect.java b/src/test/java/io/lettuce/test/CanConnect.java index dc116682b0..3e53d19e6b 100644 --- a/src/test/java/io/lettuce/test/CanConnect.java +++ b/src/test/java/io/lettuce/test/CanConnect.java @@ -40,4 +40,5 @@ private static boolean to(SocketAddress socketAddress) { return false; } } + } diff --git a/src/test/java/io/lettuce/test/CliParser.java b/src/test/java/io/lettuce/test/CliParser.java index 3665ea9e6d..0beac0e3b4 100644 --- a/src/test/java/io/lettuce/test/CliParser.java +++ b/src/test/java/io/lettuce/test/CliParser.java @@ -51,6 +51,7 @@ public static Command> parse(String command) { if (type == null) { String typeName = buffer.toString(); type = new ProtocolKeyword() { + @Override public byte[] getBytes() { return name().getBytes(StandardCharsets.UTF_8); @@ -60,6 +61,7 @@ public byte[] getBytes() { public String name() { return typeName; } + }; } else { args.addKey(buffer.toString()); @@ -70,4 +72,5 @@ public String name() { return new Command<>(type, new ArrayOutput<>(StringCodec.UTF8), args); } + } diff --git a/src/test/java/io/lettuce/test/ConnectionDecoratingInvocationHandler.java b/src/test/java/io/lettuce/test/ConnectionDecoratingInvocationHandler.java index 5920e22905..49d7f4326e 100644 --- a/src/test/java/io/lettuce/test/ConnectionDecoratingInvocationHandler.java +++ b/src/test/java/io/lettuce/test/ConnectionDecoratingInvocationHandler.java @@ -47,4 +47,5 @@ protected Object handleInvocation(Object proxy, Method method, Object[] args) th return result; } + } diff --git a/src/test/java/io/lettuce/test/ConnectionTestUtil.java b/src/test/java/io/lettuce/test/ConnectionTestUtil.java index d8e87d416d..a5beb02eae 100644 --- a/src/test/java/io/lettuce/test/ConnectionTestUtil.java +++ b/src/test/java/io/lettuce/test/ConnectionTestUtil.java @@ -148,4 +148,5 @@ public static String getConnectionState(StatefulConnection connection) { return ""; } + } diff --git a/src/test/java/io/lettuce/test/Delay.java b/src/test/java/io/lettuce/test/Delay.java index b6da1056b0..c8e08539ee 100644 --- a/src/test/java/io/lettuce/test/Delay.java +++ b/src/test/java/io/lettuce/test/Delay.java @@ -24,4 +24,5 @@ public static void delay(Duration duration) { throw new IllegalStateException(e); } } + } diff --git a/src/test/java/io/lettuce/test/KeyValueStreamingAdapter.java b/src/test/java/io/lettuce/test/KeyValueStreamingAdapter.java index 64b02198b2..3dc99cea58 100644 --- a/src/test/java/io/lettuce/test/KeyValueStreamingAdapter.java +++ b/src/test/java/io/lettuce/test/KeyValueStreamingAdapter.java @@ -29,4 +29,5 @@ public void onKeyValue(K key, V value) { public Map getMap() { return map; } + } diff --git a/src/test/java/io/lettuce/test/KeysAndValues.java b/src/test/java/io/lettuce/test/KeysAndValues.java index 33bbfe390a..e2c0cb61f8 100644 --- a/src/test/java/io/lettuce/test/KeysAndValues.java +++ b/src/test/java/io/lettuce/test/KeysAndValues.java @@ -49,4 +49,5 @@ public class KeysAndValues { VALUES = Collections.unmodifiableList(values); MAP = Collections.unmodifiableMap(map); } + } diff --git a/src/test/java/io/lettuce/test/LettuceExtension.java b/src/test/java/io/lettuce/test/LettuceExtension.java index 1d1474fc43..852b4bdbba 100644 --- a/src/test/java/io/lettuce/test/LettuceExtension.java +++ b/src/test/java/io/lettuce/test/LettuceExtension.java @@ -88,9 +88,9 @@ public class LettuceExtension implements ParameterResolver, AfterAllCallback, Af private final ExtensionContext.Namespace LETTUCE = ExtensionContext.Namespace.create("lettuce.parameters"); - private static final Set> SUPPORTED_INJECTABLE_TYPES = new HashSet<>(Arrays.asList(StatefulRedisConnection.class, - StatefulRedisPubSubConnection.class, RedisCommands.class, RedisClient.class, ClientResources.class, - StatefulRedisClusterConnection.class, RedisClusterClient.class)); + private static final Set> SUPPORTED_INJECTABLE_TYPES = new HashSet<>( + Arrays.asList(StatefulRedisConnection.class, StatefulRedisPubSubConnection.class, RedisCommands.class, + RedisClient.class, ClientResources.class, StatefulRedisClusterConnection.class, RedisClusterClient.class)); private static final Set> CLOSE_AFTER_EACH = new HashSet<>(Arrays.asList(StatefulRedisConnection.class, StatefulRedisPubSubConnection.class, StatefulRedisClusterConnection.class)); @@ -147,8 +147,8 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte private Object doGetInstance(Type parameterizedType) { Optional resourceFunction = findFunction(parameterizedType); - return resourceFunction.map(it -> it.function.apply(findSupplier(it.dependsOn.getType()).get())).orElseGet( - () -> findSupplier(parameterizedType).get()); + return resourceFunction.map(it -> it.function.apply(findSupplier(it.dependsOn.getType()).get())) + .orElseGet(() -> findSupplier(parameterizedType).get()); } /** @@ -249,7 +249,9 @@ private static Optional findFunction(Type type) { @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface Connection { + boolean requiresNew() default false; + } static class CloseAfterTest extends ArrayList { @@ -258,7 +260,9 @@ static class CloseAfterTest extends ArrayList { static class ResourceFunction { final ResolvableType dependsOn; + final ResolvableType provides; + final Function function; public ResourceFunction(ResolvableType dependsOn, ResolvableType provides, Function function) { @@ -266,6 +270,7 @@ public ResourceFunction(ResolvableType dependsOn, ResolvableType provides, Funct this.provides = provides; this.function = (Function) function; } + } enum ClientResourcesSupplier implements Supplier { @@ -276,6 +281,7 @@ enum ClientResourcesSupplier implements Supplier { public ClientResources get() { return TestClientResources.get(); } + } enum RedisClientSupplier implements Supplier { @@ -286,6 +292,7 @@ enum RedisClientSupplier implements Supplier { public RedisClient get() { return DefaultRedisClient.get(); } + } enum RedisClusterClientSupplier implements Supplier { @@ -296,6 +303,7 @@ enum RedisClusterClientSupplier implements Supplier { public RedisClusterClient get() { return DefaultRedisClusterClient.get(); } + } enum StatefulRedisConnectionSupplier implements Supplier> { @@ -306,6 +314,7 @@ enum StatefulRedisConnectionSupplier implements Supplier get() { return RedisClientSupplier.INSTANCE.get().connect(); } + } enum StatefulRedisPubSubConnectionSupplier implements Supplier> { @@ -316,6 +325,7 @@ enum StatefulRedisPubSubConnectionSupplier implements Supplier get() { return RedisClientSupplier.INSTANCE.get().connectPubSub(); } + } enum StatefulRedisClusterConnectionSupplier implements Supplier> { @@ -326,14 +336,18 @@ enum StatefulRedisClusterConnectionSupplier implements Supplier get() { return RedisClusterClientSupplier.INSTANCE.get().connect(); } + } enum RedisCommandsFunction implements Function, RedisCommands> { + INSTANCE; @Override public RedisCommands apply(StatefulRedisConnection connection) { return connection.sync(); } + } + } diff --git a/src/test/java/io/lettuce/test/ListStreamingAdapter.java b/src/test/java/io/lettuce/test/ListStreamingAdapter.java index a04d452f70..520071e57d 100644 --- a/src/test/java/io/lettuce/test/ListStreamingAdapter.java +++ b/src/test/java/io/lettuce/test/ListStreamingAdapter.java @@ -16,8 +16,9 @@ * @param Value-Type. * @since 3.0 */ -public class ListStreamingAdapter implements KeyStreamingChannel, ValueStreamingChannel, - ScoredValueStreamingChannel { +public class ListStreamingAdapter + implements KeyStreamingChannel, ValueStreamingChannel, ScoredValueStreamingChannel { + private final List list = new Vector<>(); @Override @@ -39,4 +40,5 @@ public List getList() { public void onValue(ScoredValue value) { list.add(value.getValue()); } + } diff --git a/src/test/java/io/lettuce/test/ReactiveSyncInvocationHandler.java b/src/test/java/io/lettuce/test/ReactiveSyncInvocationHandler.java index 8a7edb0a29..758327e356 100644 --- a/src/test/java/io/lettuce/test/ReactiveSyncInvocationHandler.java +++ b/src/test/java/io/lettuce/test/ReactiveSyncInvocationHandler.java @@ -51,8 +51,7 @@ protected Object handleInvocation(Object proxy, Method method, Object[] args) th Flux flux = (Flux) result; if (!method.getName().equals("exec") && !method.getName().equals("multi")) { - if (connection instanceof StatefulRedisConnection && ((StatefulRedisConnection) connection) - .isMulti()) { + if (connection instanceof StatefulRedisConnection && ((StatefulRedisConnection) connection).isMulti()) { flux.subscribe(); return null; } @@ -113,4 +112,5 @@ public static RedisSentinelCommands sync(StatefulRedisSentinelConne return (RedisSentinelCommands) Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class[] { RedisSentinelCommands.class }, handler); } + } diff --git a/src/test/java/io/lettuce/test/RoutingInvocationHandler.java b/src/test/java/io/lettuce/test/RoutingInvocationHandler.java index 6c7b55ba8b..a6e97fff42 100644 --- a/src/test/java/io/lettuce/test/RoutingInvocationHandler.java +++ b/src/test/java/io/lettuce/test/RoutingInvocationHandler.java @@ -24,4 +24,5 @@ protected Object handleInvocation(Object proxy, Method method, Object[] args) th return delegate.invoke(proxy, method, args); } + } diff --git a/src/test/java/io/lettuce/test/Wait.java b/src/test/java/io/lettuce/test/Wait.java index 38b6f6a277..8cd3560607 100644 --- a/src/test/java/io/lettuce/test/Wait.java +++ b/src/test/java/io/lettuce/test/Wait.java @@ -147,17 +147,23 @@ public static WaitBuilder untilEquals(T expectation, Supplier actualSu @FunctionalInterface interface WaitCondition { + boolean isSatisfied() throws Exception; + } @FunctionalInterface public interface VoidWaitCondition { + void test(); + } @FunctionalInterface public interface Sleeper { + void sleep() throws InterruptedException; + } static class ThreadSleep implements Sleeper { @@ -171,6 +177,7 @@ static class ThreadSleep implements Sleeper { public void sleep() throws InterruptedException { Thread.sleep(period.toMillis()); } + } /** @@ -182,10 +189,15 @@ public void sleep() throws InterruptedException { public static class WaitBuilder { private Duration duration = Duration.ofSeconds(10); + private Sleeper sleeper = new ThreadSleep(Duration.ofMillis(10)); + private Function messageFunction; + private Supplier supplier; + private Predicate check; + private WaitCondition waitCondition; public WaitBuilder during(Duration duration) { @@ -212,6 +224,7 @@ public void waitOrTimeout() { waiter.waitOrTimeout(supplier, check); } } + } /** @@ -220,7 +233,9 @@ public void waitOrTimeout() { private static class Waiter { private Duration duration; + private Sleeper sleeper; + private Function messageFunction; private void waitOrTimeout(Supplier supplier, Predicate check) { @@ -271,11 +286,13 @@ private boolean success(WaitCondition condition, Timeout timeout) throws Excepti return false; } + } static class Timeout { private static final Clock clock = Clock.systemDefaultZone(); + private final Instant timeout; private Timeout(Instant timeout) { @@ -295,5 +312,7 @@ public static Timeout create(Duration duration) { boolean hasExpired() { return clock.instant().isAfter(timeout); } + } + } diff --git a/src/test/java/io/lettuce/test/WithPassword.java b/src/test/java/io/lettuce/test/WithPassword.java index de0a804723..ff5957ae36 100644 --- a/src/test/java/io/lettuce/test/WithPassword.java +++ b/src/test/java/io/lettuce/test/WithPassword.java @@ -113,6 +113,9 @@ public static void disableAuthentication(RedisCommands commands) } public interface ThrowingCallable { + void call() throws Throwable; + } + } diff --git a/src/test/java/io/lettuce/test/condition/EnabledOnCommand.java b/src/test/java/io/lettuce/test/condition/EnabledOnCommand.java index 71ed6c4fc3..44b777290c 100644 --- a/src/test/java/io/lettuce/test/condition/EnabledOnCommand.java +++ b/src/test/java/io/lettuce/test/condition/EnabledOnCommand.java @@ -24,4 +24,5 @@ * @return */ String value(); + } diff --git a/src/test/java/io/lettuce/test/condition/EnabledOnCommandCondition.java b/src/test/java/io/lettuce/test/condition/EnabledOnCommandCondition.java index 6b54c5ee1a..9a44eccec5 100644 --- a/src/test/java/io/lettuce/test/condition/EnabledOnCommandCondition.java +++ b/src/test/java/io/lettuce/test/condition/EnabledOnCommandCondition.java @@ -35,10 +35,12 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con RedisConditions conditions = RedisConditions.of(connection); boolean hasCommand = conditions.hasCommand(command); - return hasCommand ? enabled("Enabled on command " + command) : disabled("Disabled, command " + command - + " not available on Redis version " + conditions.getRedisVersion()); + return hasCommand ? enabled("Enabled on command " + command) + : disabled( + "Disabled, command " + command + " not available on Redis version " + conditions.getRedisVersion()); } return ENABLED_BY_DEFAULT; } + } diff --git a/src/test/java/io/lettuce/test/condition/RedisConditions.java b/src/test/java/io/lettuce/test/condition/RedisConditions.java index a3aa6b42e6..94616db306 100644 --- a/src/test/java/io/lettuce/test/condition/RedisConditions.java +++ b/src/test/java/io/lettuce/test/condition/RedisConditions.java @@ -25,14 +25,15 @@ public class RedisConditions { private final Map commands; + private final Version version; private RedisConditions(RedisClusterCommands commands) { List result = CommandDetailParser.parse(commands.command()); - this.commands = result.stream().collect( - Collectors.toMap(commandDetail -> commandDetail.getName().toUpperCase(), CommandDetail::getArity)); + this.commands = result.stream() + .collect(Collectors.toMap(commandDetail -> commandDetail.getName().toUpperCase(), CommandDetail::getArity)); String info = commands.info("server"); @@ -122,8 +123,11 @@ public static class Version implements Comparable { private static final String VERSION_PARSE_ERROR = "Invalid version string! Could not parse segment %s within %s."; private final int major; + private final int minor; + private final int bugfix; + private final int build; /** @@ -229,7 +233,6 @@ public boolean isLessThanOrEqualTo(Version version) { /* * (non-Javadoc) - * * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Version that) { @@ -259,7 +262,6 @@ public int compareTo(Version that) { /* * (non-Javadoc) - * * @see java.lang.Object#equals(java.lang.Object) */ @Override @@ -281,7 +283,6 @@ public boolean equals(Object obj) { /* * (non-Javadoc) - * * @see java.lang.Object#hashCode() */ @Override @@ -297,7 +298,6 @@ public int hashCode() { /* * (non-Javadoc) - * * @see java.lang.Object#toString() */ @Override @@ -317,5 +317,7 @@ public String toString() { return digits.stream().map(Object::toString).collect(Collectors.joining(".")); } + } + } diff --git a/src/test/java/io/lettuce/test/resource/DefaultRedisClient.java b/src/test/java/io/lettuce/test/resource/DefaultRedisClient.java index 799219cba4..ec87599a9c 100644 --- a/src/test/java/io/lettuce/test/resource/DefaultRedisClient.java +++ b/src/test/java/io/lettuce/test/resource/DefaultRedisClient.java @@ -18,10 +18,12 @@ public class DefaultRedisClient { private DefaultRedisClient() { redisClient = RedisClient.create(RedisURI.Builder.redis(TestSettings.host(), TestSettings.port()).build()); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { FastShutdown.shutdown(redisClient); } + }); } @@ -34,4 +36,5 @@ public static RedisClient get() { instance.redisClient.setDefaultTimeout(60, TimeUnit.SECONDS); return instance.redisClient; } + } diff --git a/src/test/java/io/lettuce/test/resource/DefaultRedisClusterClient.java b/src/test/java/io/lettuce/test/resource/DefaultRedisClusterClient.java index 35a3b8301d..8fd1ebd13b 100644 --- a/src/test/java/io/lettuce/test/resource/DefaultRedisClusterClient.java +++ b/src/test/java/io/lettuce/test/resource/DefaultRedisClusterClient.java @@ -15,13 +15,15 @@ public class DefaultRedisClusterClient { private RedisClusterClient redisClient; private DefaultRedisClusterClient() { - redisClient = RedisClusterClient.create(RedisURI.Builder.redis(TestSettings.host(), TestSettings.port(900)) - .withClientName("my-client").build()); + redisClient = RedisClusterClient.create( + RedisURI.Builder.redis(TestSettings.host(), TestSettings.port(900)).withClientName("my-client").build()); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { FastShutdown.shutdown(redisClient); } + }); } @@ -34,4 +36,5 @@ public static RedisClusterClient get() { instance.redisClient.setOptions(ClusterClientOptions.create()); return instance.redisClient; } + } diff --git a/src/test/java/io/lettuce/test/resource/FastShutdown.java b/src/test/java/io/lettuce/test/resource/FastShutdown.java index 0d2e633c15..4f4f3434dc 100644 --- a/src/test/java/io/lettuce/test/resource/FastShutdown.java +++ b/src/test/java/io/lettuce/test/resource/FastShutdown.java @@ -27,4 +27,5 @@ public static void shutdown(AbstractRedisClient redisClient) { public static void shutdown(ClientResources clientResources) { clientResources.shutdown(0, 10, TimeUnit.MILLISECONDS); } + } diff --git a/src/test/java/io/lettuce/test/resource/TestClientResources.java b/src/test/java/io/lettuce/test/resource/TestClientResources.java index 2704e4f183..251ca7e36c 100644 --- a/src/test/java/io/lettuce/test/resource/TestClientResources.java +++ b/src/test/java/io/lettuce/test/resource/TestClientResources.java @@ -6,8 +6,8 @@ import io.lettuce.core.resource.DefaultClientResources; /** - * Client-Resources suitable for testing. Uses {@link TestEventLoopGroupProvider} to preserve the event loop - * groups between tests. Every time a new {@link TestClientResources} instance is created, shutdown hook is added + * Client-Resources suitable for testing. Uses {@link TestEventLoopGroupProvider} to preserve the event loop groups between + * tests. Every time a new {@link TestClientResources} instance is created, shutdown hook is added * {@link Runtime#addShutdownHook(Thread)}. * * @author Mark Paluch @@ -15,6 +15,7 @@ public class TestClientResources { private static final TestClientResources instance = new TestClientResources(); + private ClientResources clientResources = create(); /** @@ -37,6 +38,7 @@ public static ClientResources create() { .eventLoopGroupProvider(new TestEventLoopGroupProvider()).build(); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { try { @@ -45,6 +47,7 @@ public void run() { e.printStackTrace(); } } + }); return resources; diff --git a/src/test/java/io/lettuce/test/resource/TestEventLoopGroupProvider.java b/src/test/java/io/lettuce/test/resource/TestEventLoopGroupProvider.java index 01aee66de4..ad90105e63 100644 --- a/src/test/java/io/lettuce/test/resource/TestEventLoopGroupProvider.java +++ b/src/test/java/io/lettuce/test/resource/TestEventLoopGroupProvider.java @@ -20,6 +20,7 @@ class TestEventLoopGroupProvider extends DefaultEventLoopGroupProvider { public TestEventLoopGroupProvider() { super(10); Runtime.getRuntime().addShutdownHook(new Thread() { + @Override public void run() { try { @@ -28,6 +29,7 @@ public void run() { e.printStackTrace(); } } + }); } @@ -38,4 +40,5 @@ public Promise release(EventExecutorGroup eventLoopGroup, long quietPer return result; } + } diff --git a/src/test/java/io/lettuce/test/server/MockTcpServer.java b/src/test/java/io/lettuce/test/server/MockTcpServer.java index baa57ee4ed..0f2249af51 100644 --- a/src/test/java/io/lettuce/test/server/MockTcpServer.java +++ b/src/test/java/io/lettuce/test/server/MockTcpServer.java @@ -20,8 +20,11 @@ public class MockTcpServer { private EventLoopGroup bossGroup; + private EventLoopGroup workerGroup; + private Channel channel; + private List> handlers = new ArrayList<>(); public void addHandler(Supplier supplier) { @@ -36,6 +39,7 @@ public void initialize(int port) throws InterruptedException { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 100) .childHandler(new ChannelInitializer() { + @Override public void initChannel(SocketChannel ch) { ChannelPipeline p = ch.pipeline(); @@ -45,6 +49,7 @@ public void initChannel(SocketChannel ch) { p.addLast(handler.get()); } } + }); // Start the server. @@ -60,6 +65,7 @@ public void shutdown() { private static class Resources { private static final EventLoopGroup bossGroup; + private static final EventLoopGroup workerGroup; static { @@ -74,4 +80,5 @@ private static class Resources { } } + } diff --git a/src/test/java/io/lettuce/test/server/RandomResponseServer.java b/src/test/java/io/lettuce/test/server/RandomResponseServer.java index bb8d8e3c71..c57d2f58e3 100644 --- a/src/test/java/io/lettuce/test/server/RandomResponseServer.java +++ b/src/test/java/io/lettuce/test/server/RandomResponseServer.java @@ -10,4 +10,5 @@ public class RandomResponseServer extends MockTcpServer { public RandomResponseServer() { addHandler(RandomServerHandler::new); } + } diff --git a/src/test/java/io/lettuce/test/server/RandomServerHandler.java b/src/test/java/io/lettuce/test/server/RandomServerHandler.java index 9915d53aee..817ec119f6 100644 --- a/src/test/java/io/lettuce/test/server/RandomServerHandler.java +++ b/src/test/java/io/lettuce/test/server/RandomServerHandler.java @@ -49,4 +49,5 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { cause.printStackTrace(); ctx.close(); } + } From c0c578281ea6077ab4b5d38a1c3c1dce09e19804 Mon Sep 17 00:00:00 2001 From: atakavci <58048133+atakavci@users.noreply.github.com> Date: Tue, 7 May 2024 18:46:49 +0300 Subject: [PATCH 10/28] Update cicd.yaml the issue related apt repo has been fixed https://github.com/orgs/community/discussions/120966#discussioncomment-9211925 --- .github/workflows/cicd.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 3846e60083..692738de40 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -36,9 +36,7 @@ jobs: java-version: 8 - name: Install missing dependencies to container run: | - : # workaround for apt update issue related to Clearsigned file - : # details on https://github.com/orgs/community/discussions/120966#discussioncomment-9211925 - sudo apt update || true + sudo apt update sudo apt install -y stunnel make git gcc - name: Maven offline run: | From 4eac60977dd0169c2f4f59a8da874410ba86fd3e Mon Sep 17 00:00:00 2001 From: Liming Deng Date: Tue, 14 May 2024 20:05:36 +0800 Subject: [PATCH 11/28] Add support CLIENT KILL [MAXAGE] (#2782) * Add support CLIENT KILL [MAXAGE] * polish * address review changes * format code --- src/main/java/io/lettuce/core/KillArgs.java | 32 +++++++++++++++++++ .../ServerCommandIntegrationTests.java | 19 +++++++++++ 2 files changed, 51 insertions(+) diff --git a/src/main/java/io/lettuce/core/KillArgs.java b/src/main/java/io/lettuce/core/KillArgs.java index 2a71b051d7..d24325c504 100644 --- a/src/main/java/io/lettuce/core/KillArgs.java +++ b/src/main/java/io/lettuce/core/KillArgs.java @@ -54,6 +54,8 @@ private enum Type { private String username; + private Long maxAge; + /** * Builder entry points for {@link KillArgs}. */ @@ -160,6 +162,17 @@ public static KillArgs user(String username) { return new KillArgs().user(username); } + /** + * Creates new {@link KillArgs} setting {@literal MAXAGE}. + * + * @return new {@link KillArgs} with {@literal MAXAGE} set. + * @see KillArgs#maxAge(Long) + * @since 7.0 + */ + public static KillArgs maxAge(Long maxAge) { + return new KillArgs().maxAge(maxAge); + } + } /** @@ -241,6 +254,21 @@ public KillArgs type(Type type) { return this; } + /** + * Closes all the connections that are older than the specified age, in seconds. + * + * @param maxAge must not be {@code null}. + * @return {@code this} {@link KillArgs}. + * @since 7.0 + */ + public KillArgs maxAge(Long maxAge) { + + LettuceAssert.notNull(maxAge, "MaxAge must not be null"); + + this.maxAge = maxAge; + return this; + } + /** * Closes all the connections that are authenticated with the specified ACL {@code username}. * @@ -282,6 +310,10 @@ public void build(CommandArgs args) { if (username != null) { args.add("USER").add(username); } + + if (maxAge != null) { + args.add("MAXAGE").add(maxAge); + } } } diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index b10517dfd9..e3395454bf 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -35,6 +35,7 @@ import io.lettuce.core.cluster.ClusterReadOnlyCommands; import io.lettuce.core.protocol.ProtocolKeyword; +import io.lettuce.test.condition.RedisConditions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -188,6 +189,24 @@ void clientKillUser() { redis.aclDeluser("test_kill"); } + @Test + void clientKillMaxAge() throws InterruptedException { + // can not find other new command to use `@EnabledOnCommand` for now, so check the version + assumeTrue(RedisConditions.of(redis).hasVersionGreaterOrEqualsTo("8.0")); + + RedisCommands connection2 = client.connect().sync(); + long inactiveId = connection2.clientId(); + long maxAge = 2L; + // sleep for maxAge * 2 seconds, to be sure + TimeUnit.SECONDS.sleep(maxAge * 2); + RedisCommands connection3 = client.connect().sync(); + long activeId = connection3.clientId(); + assertThat(redis.clientKill(KillArgs.Builder.maxAge(maxAge))).isGreaterThan(0); + + assertThat(redis.clientList(ClientListArgs.Builder.ids(inactiveId))).isBlank(); + assertThat(redis.clientList(ClientListArgs.Builder.ids(activeId))).isNotBlank(); + } + @Test void clientId() { assertThat(redis.clientId()).isNotNull(); From 28997705bf5afc28b915e11918604104d2122ced Mon Sep 17 00:00:00 2001 From: atakavci <58048133+atakavci@users.noreply.github.com> Date: Mon, 20 May 2024 10:05:19 +0300 Subject: [PATCH 12/28] Add support for `SUNSUBSCRIBE` #2759 (#2851) * Add support for `SUNSUBSCRIBE` #2759 * replace junit.Assert with assertj --- .../ClusterPubSubConnectionProvider.java | 5 +++ .../core/cluster/PubSubClusterEndpoint.java | 9 +++++ .../pubsub/RedisClusterPubSubAdapter.java | 5 +++ .../pubsub/RedisClusterPubSubListener.java | 12 ++++++ .../NodeSelectionPubSubAsyncCommands.java | 9 +++++ .../NodeSelectionPubSubReactiveCommands.java | 9 +++++ .../api/sync/NodeSelectionPubSubCommands.java | 9 +++++ .../io/lettuce/core/protocol/CommandType.java | 2 +- .../core/pubsub/PubSubCommandBuilder.java | 8 ++++ .../core/pubsub/PubSubCommandHandler.java | 3 ++ .../lettuce/core/pubsub/PubSubEndpoint.java | 6 +++ .../io/lettuce/core/pubsub/PubSubOutput.java | 3 +- .../core/pubsub/RedisPubSubAdapter.java | 5 +++ .../pubsub/RedisPubSubAsyncCommandsImpl.java | 6 +++ .../core/pubsub/RedisPubSubListener.java | 11 +++++ .../RedisPubSubReactiveCommandsImpl.java | 5 +++ .../api/async/RedisPubSubAsyncCommands.java | 9 +++++ .../reactive/RedisPubSubReactiveCommands.java | 10 +++++ .../pubsub/api/sync/RedisPubSubCommands.java | 8 ++++ ...usterPubSubConnectionIntegrationTests.java | 16 ++++++++ .../pubsub/PubSubCommandBuilderUnitTests.java | 11 +++++ .../core/pubsub/PubSubReactiveTest.java | 13 ++++++ ...RedisPubSubAsyncCommandsImplUnitTests.java | 40 ++++++++++++++----- .../core/support/PubSubTestListener.java | 6 +++ 24 files changed, 207 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java b/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java index 747018ca60..2340ef9344 100644 --- a/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java +++ b/src/main/java/io/lettuce/core/cluster/ClusterPubSubConnectionProvider.java @@ -177,6 +177,11 @@ public void ssubscribed(K channel, long count) { notifications.ssubscribed(getNode(), channel, count); } + @Override + public void sunsubscribed(K channel, long count) { + notifications.sunsubscribed(getNode(), channel, count); + } + private RedisClusterNode getNode() { return nodeId != null ? getPartitions().getPartitionByNodeId(nodeId) : getPartitions().getPartition(host, port); } diff --git a/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java b/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java index 9288dd8f85..9ec0a019c6 100644 --- a/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java +++ b/src/main/java/io/lettuce/core/cluster/PubSubClusterEndpoint.java @@ -94,6 +94,9 @@ protected void notifyListeners(PubSubMessage output) { case ssubscribe: multicast.ssubscribed(clusterNode, output.channel(), output.count()); break; + case sunsubscribe: + multicast.sunsubscribed(clusterNode, output.channel(), output.count()); + break; default: throw new UnsupportedOperationException("Operation " + output.type() + " not supported"); } @@ -207,6 +210,12 @@ public void ssubscribed(RedisClusterNode node, K channel, long count) { clusterListeners.forEach(listener -> listener.ssubscribed(node, channel, count)); } + @Override + public void sunsubscribed(RedisClusterNode node, K channel, long count) { + getListeners().forEach(listener -> listener.sunsubscribed(channel, count)); + clusterListeners.forEach(listener -> listener.sunsubscribed(node, channel, count)); + } + } } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java index 554efa3009..3c7822af6b 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubAdapter.java @@ -52,4 +52,9 @@ public void ssubscribed(RedisClusterNode node, K channel, long count) { // empty adapter method } + @Override + public void sunsubscribed(RedisClusterNode node, K channel, long count) { + // empty adapter method + } + } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java index 93da2f5313..b1755f80b9 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java @@ -91,4 +91,16 @@ default void ssubscribed(RedisClusterNode node, K shardChannel, long count) { subscribed(node, shardChannel, count); } + /** + * Unsubscribed from a shard channel. + * + * @param node the {@link RedisClusterNode} from which the {@code message} originates. + * @param shardChannel Shard channel + * @param count Subscription count. + * @since 7.0 + */ + default void sunsubscribed(RedisClusterNode node, K shardChannel, long count) { + unsubscribed(node, shardChannel, count); + } + } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java index 512afbaabd..19f1980e01 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java @@ -51,4 +51,13 @@ public interface NodeSelectionPubSubAsyncCommands { */ AsyncExecutions ssubscribe(K... shardChannels); + /** + * Stop listening for messages posted to the given shard channels. + * + * @param shardChannels the channels + * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. + * @since 7.0 + */ + AsyncExecutions sunsubscribe(K... shardChannels); + } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java index b61395cf2e..3da91dddd1 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java @@ -51,4 +51,13 @@ public interface NodeSelectionPubSubReactiveCommands { */ ReactiveExecutions ssubscribe(K... shardCchannels); + /** + * Stop listening for messages posted to the given shard channels. + * + * @param shardCchannels the channels + * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. + * @since 7.0 + */ + ReactiveExecutions sunsubscribe(K... shardCchannels); + } diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java index ba7fe76af7..6a3716c9fc 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java @@ -51,4 +51,13 @@ public interface NodeSelectionPubSubCommands { */ Executions ssubscribe(K... shardChannels); + /** + * Stop listening for messages posted to the given channels. + * + * @param shardChannels the channels + * @return Executions Future to synchronize {@code unsubscribe} completion. + * @since 7.0 + */ + Executions sunsubscribe(K... shardChannels); + } diff --git a/src/main/java/io/lettuce/core/protocol/CommandType.java b/src/main/java/io/lettuce/core/protocol/CommandType.java index da1f6499c8..37ae008fb1 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandType.java +++ b/src/main/java/io/lettuce/core/protocol/CommandType.java @@ -74,7 +74,7 @@ public enum CommandType implements ProtocolKeyword { // Pub/Sub - PSUBSCRIBE, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, UNSUBSCRIBE, PUBSUB, SSUBSCRIBE, SPUBLISH, + PSUBSCRIBE, PUBLISH, PUNSUBSCRIBE, SUBSCRIBE, UNSUBSCRIBE, PUBSUB, SSUBSCRIBE, SPUBLISH, SUNSUBSCRIBE, // Sets diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java index 3da52d877f..65c226593e 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubCommandBuilder.java @@ -118,6 +118,14 @@ final Command subscribe(K... channels) { return pubSubCommand(SUBSCRIBE, new PubSubOutput<>(codec), channels); } + @SafeVarargs + final Command sunsubscribe(K... shardChannels) { + LettuceAssert.notEmpty(shardChannels, "Shard channels " + MUST_NOT_BE_EMPTY); + + CommandArgs args = new CommandArgs<>(codec).addKeys(shardChannels); + return createCommand(SUNSUBSCRIBE, new PubSubOutput<>(codec), args); + } + @SafeVarargs final Command unsubscribe(K... channels) { return pubSubCommand(UNSUBSCRIBE, new PubSubOutput<>(codec), channels); diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java b/src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java index 0cb9bd1a55..30d811c71f 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubCommandHandler.java @@ -227,6 +227,9 @@ private boolean shouldCompleteCommand(PubSubOutput.Type type, RedisCommand message) { case ssubscribe: listener.ssubscribed(message.channel(), message.count()); break; + case sunsubscribe: + listener.sunsubscribed(message.channel(), message.count()); + break; default: throw new UnsupportedOperationException("Operation " + message.type() + " not supported"); } @@ -293,6 +296,9 @@ private void updateInternalState(PubSubMessage message) { case ssubscribe: shardChannels.add(new Wrapper<>(message.channel())); break; + case sunsubscribe: + shardChannels.remove(new Wrapper<>(message.channel())); + break; default: break; } diff --git a/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java b/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java index 18c19ccddb..0ec41ff646 100644 --- a/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java +++ b/src/main/java/io/lettuce/core/pubsub/PubSubOutput.java @@ -38,7 +38,7 @@ public class PubSubOutput extends CommandOutput implements PubSub public enum Type { - message, pmessage, psubscribe, punsubscribe, subscribe, unsubscribe, ssubscribe, smessage; + message, pmessage, psubscribe, punsubscribe, subscribe, unsubscribe, ssubscribe, smessage, sunsubscribe; private final static Set names = new HashSet<>(); @@ -124,6 +124,7 @@ private void handleOutput(ByteBuffer bytes) { case subscribe: case unsubscribe: case ssubscribe: + case sunsubscribe: channel = codec.decodeKey(bytes); break; default: diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java index 8b061bacf0..20f03c1bbc 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAdapter.java @@ -69,4 +69,9 @@ public void ssubscribed(K shardChannel, long count) { // empty adapter method } + @Override + public void sunsubscribed(K shardChannel, long count) { + // empty adapter method + } + } diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java index 20515e60fd..3e282b5410 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImpl.java @@ -111,6 +111,12 @@ public RedisFuture ssubscribe(K... channels) { return (RedisFuture) dispatch(commandBuilder.ssubscribe(channels)); } + @Override + @SuppressWarnings("unchecked") + public RedisFuture sunsubscribe(K... channels) { + return (RedisFuture) dispatch(commandBuilder.sunsubscribe(channels)); + } + @Override @SuppressWarnings("unchecked") public StatefulRedisPubSubConnection getStatefulConnection() { diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java index ccc1f0e1e1..ae0aff2e4a 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java @@ -88,6 +88,17 @@ default void ssubscribed(K shardChannel, long count) { subscribed(shardChannel, count); } + /** + * Unsubscribed from a shard channel. + * + * @param shardChannel Channel + * @param count Subscription count. + * @since 7.0 + */ + default void sunsubscribed(K shardChannel, long count) { + unsubscribed(shardChannel, count); + } + /** * Message received from a shard channel subscription. * diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java index adff1b58fa..19e878f3f6 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubReactiveCommandsImpl.java @@ -169,6 +169,11 @@ public Mono ssubscribe(K... shardChannels) { return createFlux(() -> commandBuilder.ssubscribe(shardChannels)).then(); } + @Override + public Mono sunsubscribe(K... shardChannels) { + return createFlux(() -> commandBuilder.sunsubscribe(shardChannels)).then(); + } + @Override @SuppressWarnings("unchecked") public StatefulRedisPubSubConnection getStatefulConnection() { diff --git a/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java b/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java index 90c301a58e..8750588552 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java @@ -60,4 +60,13 @@ public interface RedisPubSubAsyncCommands extends RedisAsyncCommands */ RedisFuture ssubscribe(K... shardChannels); + /** + * Stop listening for messages posted to the given channels. + * + * @param shardChannels the shard channels + * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. + * @since 7.0 + */ + RedisFuture sunsubscribe(K... shardChannels); + } diff --git a/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java b/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java index d6f0476d67..6f1f0e0817 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java @@ -107,6 +107,16 @@ public interface RedisPubSubReactiveCommands extends RedisReactiveCommands */ Mono ssubscribe(K... shardChannels); + /** + * Stop listening for messages posted to the given channels. The {@link Mono} completes without a result as soon as the + * subscription is unregistered. + * + * @param shardChannels the channels. + * @return Mono<Void> Mono for {@code unsubscribe} command. + * @since 7.0 + */ + Mono sunsubscribe(K... shardChannels); + /** * @return the underlying connection. * @since 6.2, will be removed with Lettuce 7 to avoid exposing the underlying connection. diff --git a/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java b/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java index 44a59b6c6d..b3ea69fb62 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java @@ -49,6 +49,14 @@ public interface RedisPubSubCommands extends RedisCommands { */ void ssubscribe(K... shardChannels); + /** + * Stop listening for messages posted to the given channels. + * + * @param shardChannels the channels + * @since 7.0 + */ + void sunsubscribe(K... shardChannels); + /** * @return the underlying connection. */ diff --git a/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java b/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java index 772af41dab..cd08f520e6 100644 --- a/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java +++ b/src/test/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubConnectionIntegrationTests.java @@ -211,6 +211,22 @@ void publishToShardChannelViaNewClientWithNoRedirects() throws Exception { cmd.getStatefulConnection().close(); } + @Test + @EnabledOnCommand("SSUBSCRIBE") + void unubscribeFromShardChannel() { + pubSubConnection.sync().ssubscribe(shardChannel); + pubSubConnection.sync().spublish(shardChannel, "msg1"); + + pubSubConnection.sync().sunsubscribe(shardChannel); + pubSubConnection.sync().spublish(shardChannel, "msg2"); + + pubSubConnection.sync().ssubscribe(shardChannel); + pubSubConnection.sync().spublish(shardChannel, "msg3"); + + Wait.untilEquals("msg1", connectionListener.getMessages()::poll).waitOrTimeout(); + Wait.untilEquals("msg3", connectionListener.getMessages()::poll).waitOrTimeout(); + } + @Test void myIdWorksAfterDisconnect() throws InterruptedException { diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubCommandBuilderUnitTests.java b/src/test/java/io/lettuce/core/pubsub/PubSubCommandBuilderUnitTests.java index 4d4e798187..89e93b234e 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubCommandBuilderUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubCommandBuilderUnitTests.java @@ -139,4 +139,15 @@ void ssubscribe() { assertThat(command.getOutput()).isInstanceOf(PubSubOutput.class); } + @Test + void sunsubscribe() { + String channel = "channelPattern"; + Command command = this.commandBuilder.sunsubscribe(channel); + + assertThat(command.getType()).isEqualTo(SUNSUBSCRIBE); + assertThat(command.getArgs()).isInstanceOf(CommandArgs.class); + assertThat(command.getArgs().toCommandString()).isEqualTo("key"); + assertThat(command.getOutput()).isInstanceOf(PubSubOutput.class); + } + } diff --git a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java index e5d91a156e..7dd7d11001 100644 --- a/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java +++ b/src/test/java/io/lettuce/core/pubsub/PubSubReactiveTest.java @@ -357,6 +357,13 @@ void ssubscribe() throws Exception { assertThat((long) counts.take()).isGreaterThan(0); } + @Test + void sunsubscribe() throws Exception { + StepVerifier.create(pubsub.sunsubscribe(channel)).verifyComplete(); + assertThat(shardChannels.take()).isEqualTo(channel); + assertThat((long) counts.take()).isEqualTo(0); + } + @Test void pubsubCloseOnClientShutdown() { @@ -515,6 +522,12 @@ public void ssubscribed(String shardChannel, long count) { counts.add(count); } + @Override + public void sunsubscribed(String shardChannel, long count) { + shardChannels.add(shardChannel); + counts.add(count); + } + T block(Mono mono) { return mono.block(); } diff --git a/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java b/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java index 65b0a960aa..49dee5c2d8 100644 --- a/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java +++ b/src/test/java/io/lettuce/core/pubsub/RedisPubSubAsyncCommandsImplUnitTests.java @@ -15,7 +15,6 @@ import static io.lettuce.core.protocol.CommandType.*; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; @@ -50,7 +49,7 @@ void psubscribe() throws ExecutionException, InterruptedException { assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -69,7 +68,7 @@ void punsubscribe() throws ExecutionException, InterruptedException { assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -88,7 +87,7 @@ void subscribe() throws ExecutionException, InterruptedException { assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -107,7 +106,7 @@ void unsubscribe() throws ExecutionException, InterruptedException { assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -128,7 +127,7 @@ void publish() throws ExecutionException, InterruptedException { assertInstanceOf(IntegerOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key value"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -148,7 +147,7 @@ void pubsubChannels() throws ExecutionException, InterruptedException { assertInstanceOf(KeyListOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("CHANNELS key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -168,7 +167,7 @@ void pubsubNumsub() throws ExecutionException, InterruptedException { assertInstanceOf(MapOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("NUMSUB key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -188,7 +187,7 @@ void pubsubShardChannels() throws ExecutionException, InterruptedException { assertInstanceOf(KeyListOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("SHARDCHANNELS key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -208,7 +207,7 @@ void pubsubShardNumsub() throws ExecutionException, InterruptedException { assertInstanceOf(MapOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("SHARDNUMSUB key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } @Test @@ -227,7 +226,26 @@ void ssubscribe() throws ExecutionException, InterruptedException { assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); - assertNotEquals(capturedCommand.getValue(), dispachedMock); + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); + } + + @Test + void sunsubscribe() throws ExecutionException, InterruptedException { + String pattern = "channelPattern"; + AsyncCommand dispachedMock = mock(AsyncCommand.class); + when(mockedConnection.dispatch((RedisCommand) any())).thenReturn(dispachedMock); + + commands.sunsubscribe(pattern).get(); + + ArgumentCaptor capturedCommand = ArgumentCaptor.forClass(AsyncCommand.class); + + verify(mockedConnection).dispatch(capturedCommand.capture()); + + assertThat(capturedCommand.getValue().getType()).isEqualTo(SUNSUBSCRIBE); + assertInstanceOf(PubSubOutput.class, capturedCommand.getValue().getOutput()); + assertThat(capturedCommand.getValue().getArgs().toCommandString()).isEqualTo("key"); + + assertThat(capturedCommand.getValue()).isNotEqualTo(dispachedMock); } } diff --git a/src/test/java/io/lettuce/core/support/PubSubTestListener.java b/src/test/java/io/lettuce/core/support/PubSubTestListener.java index 1afcb42766..fa7d0f6fc0 100644 --- a/src/test/java/io/lettuce/core/support/PubSubTestListener.java +++ b/src/test/java/io/lettuce/core/support/PubSubTestListener.java @@ -74,6 +74,12 @@ public void ssubscribed(String shardChannel, long count) { shardCounts.add(count); } + @Override + public void sunsubscribed(String shardChannel, long count) { + shardChannels.add(shardChannel); + counts.add(count); + } + @Override public void psubscribed(String pattern, long count) { patterns.add(pattern); From 7a5f98860556522ee3b8c25d6d9e981119674ccc Mon Sep 17 00:00:00 2001 From: Wang Zhi Date: Wed, 22 May 2024 15:08:11 +0800 Subject: [PATCH 13/28] Mark dnsResolver(DnsResolver) as deprecated. (#2855) --- .../java/io/lettuce/core/resource/DefaultClientResources.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/lettuce/core/resource/DefaultClientResources.java b/src/main/java/io/lettuce/core/resource/DefaultClientResources.java index 1922bfef66..592ffff4ab 100644 --- a/src/main/java/io/lettuce/core/resource/DefaultClientResources.java +++ b/src/main/java/io/lettuce/core/resource/DefaultClientResources.java @@ -447,7 +447,9 @@ public Builder computationThreadPoolSize(int computationThreadPoolSize) { * @param dnsResolver the DNS resolver, must not be {@code null}. * @return {@code this} {@link Builder}. * @since 4.3 + * @deprecated since 6.1. Configure {@link AddressResolverGroup} instead. */ + @Deprecated @Override public Builder dnsResolver(DnsResolver dnsResolver) { From 11e5ee6d30b65fd44a9ffb2abdb7340c1904ee49 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Wed, 22 May 2024 16:01:11 +0300 Subject: [PATCH 14/28] Implement HPEXPIRE, HPEXPIREAT, HPEXPIRETIME, HTTL and HPTTL (#2857) * Fixes to the hash field expiration functions * Implemented HPEXPIRE, HPEXPIREAT, HPEXPIRETIME, HTTL, HPTTL * Format the files * FIELDS keyword was introduced as per the PRD * Extend tests to include HTTL * Repair unit tests, add new ones for the new commands * Disable failing test, becasue it is very unstable * Modify return value to list of long values, fix cluster logic * Polishing * Polishing - addressed Ali's comments * Polishing: Modified by mistake * Polishing : Addressed Marks' comments --- .../core/AbstractRedisAsyncCommands.java | 92 +++++- .../core/AbstractRedisReactiveCommands.java | 100 ++++++- .../io/lettuce/core/RedisCommandBuilder.java | 117 +++++--- .../api/async/RedisHashAsyncCommands.java | 276 ++++++++++++++--- .../reactive/RedisHashReactiveCommands.java | 278 +++++++++++++++--- .../core/api/sync/RedisHashCommands.java | 278 +++++++++++++++--- .../async/NodeSelectionHashAsyncCommands.java | 276 ++++++++++++++--- .../api/sync/NodeSelectionHashCommands.java | 276 ++++++++++++++--- .../core/output/IntegerListOutput.java | 17 +- .../lettuce/core/protocol/CommandKeyword.java | 2 +- .../io/lettuce/core/protocol/CommandType.java | 2 +- .../coroutines/RedisHashCoroutinesCommands.kt | 277 ++++++++++++++--- .../RedisHashCoroutinesCommandsImpl.kt | 109 +++++-- .../lettuce/core/api/RedisHashCommands.java | 276 ++++++++++++++--- .../core/RedisCommandBuilderUnitTests.java | 82 +++++- .../io/lettuce/core/SslIntegrationTests.java | 44 +-- .../commands/HashCommandIntegrationTests.java | 86 +++--- .../output/IntegerListOutputUnitTests.java | 103 +++++++ 18 files changed, 2252 insertions(+), 439 deletions(-) create mode 100644 src/test/java/io/lettuce/core/output/IntegerListOutputUnitTests.java diff --git a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java index 9a37545f49..4749ad984f 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java @@ -799,26 +799,94 @@ public RedisFuture expire(K key, Duration seconds, ExpireArgs expireArg } @Override - public RedisFuture hexpire(K key, long seconds, K... fields) { + public RedisFuture> hexpire(K key, long seconds, K... fields) { return hexpire(key, seconds, null, fields); } @Override - public RedisFuture hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + public RedisFuture> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { return dispatch(commandBuilder.hexpire(key, seconds, expireArgs, fields)); } @Override - public RedisFuture hexpire(K key, Duration seconds, K... fields) { + public RedisFuture> hexpire(K key, Duration seconds, K... fields) { return hexpire(key, seconds, null, fields); } @Override - public RedisFuture hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { + public RedisFuture> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(seconds, "Timeout must not be null"); return hexpire(key, seconds.toMillis() / 1000, expireArgs, fields); } + @Override + public RedisFuture> httl(K key, K... fields) { + return dispatch(commandBuilder.httl(key, fields)); + } + + @Override + public RedisFuture> hpexpire(K key, long milliseconds, K... fields) { + return hpexpire(key, milliseconds, null, fields); + } + + @Override + public RedisFuture> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields) { + return dispatch(commandBuilder.hpexpire(key, milliseconds, expireArgs, fields)); + } + + @Override + public RedisFuture> hpexpire(K key, Duration milliseconds, K... fields) { + return hpexpire(key, milliseconds, null, fields); + } + + @Override + public RedisFuture> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(milliseconds, "Timeout must not be null"); + return hpexpire(key, milliseconds.toMillis(), expireArgs, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, Date timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hpexpireat(key, timestamp.getTime(), expireArgs, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, Instant timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hpexpireat(key, timestamp.toEpochMilli(), expireArgs, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, long timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public RedisFuture> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + return dispatch(commandBuilder.hpexpireat(key, timestamp, expireArgs, fields)); + } + + @Override + public RedisFuture> hpexpiretime(K key, K... fields) { + return dispatch(commandBuilder.hpexpiretime(key, fields)); + } + + @Override + public RedisFuture> hpttl(K key, K... fields) { + return dispatch(commandBuilder.hpttl(key, fields)); + } + @Override public RedisFuture expireat(K key, long timestamp) { return expireat(key, timestamp, null); @@ -852,34 +920,34 @@ public RedisFuture expireat(K key, Instant timestamp, ExpireArgs expire } @Override - public RedisFuture hexpireat(K key, long timestamp, K... fields) { + public RedisFuture> hexpireat(K key, long timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public RedisFuture hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + public RedisFuture> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { return dispatch(commandBuilder.hexpireat(key, timestamp, expireArgs, fields)); } @Override - public RedisFuture hexpireat(K key, Date timestamp, K... fields) { + public RedisFuture> hexpireat(K key, Date timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public RedisFuture hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + public RedisFuture> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(timestamp, "Timestamp must not be null"); return hexpireat(key, timestamp.getTime() / 1000, expireArgs, fields); } @Override - public RedisFuture hexpireat(K key, Instant timestamp, K... fields) { + public RedisFuture> hexpireat(K key, Instant timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public RedisFuture hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + public RedisFuture> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(timestamp, "Timestamp must not be null"); return hexpireat(key, timestamp.toEpochMilli() / 1000, expireArgs, fields); } @@ -890,7 +958,7 @@ public RedisFuture expiretime(K key) { } @Override - public RedisFuture hexpiretime(K key, K... fields) { + public RedisFuture> hexpiretime(K key, K... fields) { return dispatch(commandBuilder.hexpiretime(key, fields)); } @@ -1553,7 +1621,7 @@ public RedisFuture persist(K key) { } @Override - public RedisFuture hpersist(K key, K... fields) { + public RedisFuture> hpersist(K key, K... fields) { return dispatch(commandBuilder.hpersist(key, fields)); } diff --git a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java index 16ae6c5796..fa5630ed71 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java @@ -859,22 +859,22 @@ public Mono expire(K key, Duration seconds, ExpireArgs expireArgs) { } @Override - public Mono hexpire(K key, long seconds, K... fields) { + public Flux hexpire(K key, long seconds, K... fields) { return hexpire(key, seconds, null, fields); } @Override - public Mono hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { - return createMono(() -> commandBuilder.hexpire(key, seconds, expireArgs, fields)); + public Flux hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hexpire(key, seconds, expireArgs, fields)); } @Override - public Mono hexpire(K key, Duration seconds, K... fields) { + public Flux hexpire(K key, Duration seconds, K... fields) { return hexpire(key, seconds, null, fields); } @Override - public Mono hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { + public Flux hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(seconds, "Timeout must not be null"); return hexpire(key, seconds.toMillis() / 1000, expireArgs, fields); } @@ -912,33 +912,33 @@ public Mono expireat(K key, Instant timestamp, ExpireArgs expireArgs) { } @Override - public Mono hexpireat(K key, long timestamp, K... fields) { + public Flux hexpireat(K key, long timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public Mono hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { - return createMono(() -> commandBuilder.hexpireat(key, timestamp, expireArgs, fields)); + public Flux hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hexpireat(key, timestamp, expireArgs, fields)); } @Override - public Mono hexpireat(K key, Date timestamp, K... fields) { + public Flux hexpireat(K key, Date timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public Mono hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + public Flux hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(timestamp, "Timestamp must not be null"); return hexpireat(key, timestamp.getTime() / 1000, expireArgs, fields); } @Override - public Mono hexpireat(K key, Instant timestamp, K... fields) { + public Flux hexpireat(K key, Instant timestamp, K... fields) { return hexpireat(key, timestamp, null, fields); } @Override - public Mono hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + public Flux hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { LettuceAssert.notNull(timestamp, "Timestamp must not be null"); return hexpireat(key, timestamp.toEpochMilli() / 1000, expireArgs, fields); } @@ -949,8 +949,76 @@ public Mono expiretime(K key) { } @Override - public Mono hexpiretime(K key, K... fields) { - return createMono(() -> commandBuilder.hexpiretime(key, fields)); + public Flux hexpiretime(K key, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hexpiretime(key, fields)); + } + + @Override + public Flux httl(K key, K... fields) { + return createDissolvingFlux(() -> commandBuilder.httl(key, fields)); + } + + @Override + public Flux hpexpire(K key, long milliseconds, K... fields) { + return hpexpire(key, milliseconds, null, fields); + } + + @Override + public Flux hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hpexpire(key, milliseconds, expireArgs, fields)); + } + + @Override + public Flux hpexpire(K key, Duration milliseconds, K... fields) { + return hpexpire(key, milliseconds, null, fields); + } + + @Override + public Flux hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(milliseconds, "Timeout must not be null"); + return hpexpire(key, milliseconds.toMillis(), expireArgs, fields); + } + + @Override + public Flux hpexpireat(K key, Date timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public Flux hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hpexpireat(key, timestamp.getTime(), expireArgs, fields); + } + + @Override + public Flux hpexpireat(K key, Instant timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public Flux hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields) { + LettuceAssert.notNull(timestamp, "Timestamp must not be null"); + return hpexpireat(key, timestamp.toEpochMilli(), expireArgs, fields); + } + + @Override + public Flux hpexpireat(K key, long timestamp, K... fields) { + return hpexpireat(key, timestamp, null, fields); + } + + @Override + public Flux hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hpexpireat(key, timestamp, expireArgs, fields)); + } + + @Override + public Flux hpexpiretime(K key, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hpexpiretime(key, fields)); + } + + @Override + public Flux hpttl(K key, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hpttl(key, fields)); } @Override @@ -1619,8 +1687,8 @@ public Mono persist(K key) { } @Override - public Mono hpersist(K key, K... fields) { - return createMono(() -> commandBuilder.hpersist(key, fields)); + public Flux hpersist(K key, K... fields) { + return createDissolvingFlux(() -> commandBuilder.hpersist(key, fields)); } @Override diff --git a/src/main/java/io/lettuce/core/RedisCommandBuilder.java b/src/main/java/io/lettuce/core/RedisCommandBuilder.java index 8d74e0deb9..1a5e4d1645 100644 --- a/src/main/java/io/lettuce/core/RedisCommandBuilder.java +++ b/src/main/java/io/lettuce/core/RedisCommandBuilder.java @@ -978,9 +978,8 @@ Command expire(K key, long seconds, ExpireArgs expireArgs) { return createCommand(EXPIRE, new BooleanOutput<>(codec), args); } - Command hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { - notNullKey(key); - notEmpty(fields); + Command> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields) { + keyAndFieldsProvided(key, fields); CommandArgs args = new CommandArgs<>(codec).addKey(key).add(seconds); @@ -988,15 +987,13 @@ Command hexpire(K key, long seconds, ExpireArgs expireArgs, K... expireArgs.build(args); } - args.add(fields.length); - args.addKeys(fields); + args.add(FIELDS).add(fields.length).addKeys(fields); - return createCommand(HEXPIRE, new BooleanOutput<>(codec), args); + return createCommand(HEXPIRE, new IntegerListOutput<>(codec), args); } - Command hexpireat(K key, long seconds, ExpireArgs expireArgs, K... fields) { - notNullKey(key); - notEmpty(fields); + Command> hexpireat(K key, long seconds, ExpireArgs expireArgs, K... fields) { + keyAndFieldsProvided(key, fields); CommandArgs args = new CommandArgs<>(codec).addKey(key).add(seconds); @@ -1004,10 +1001,64 @@ Command hexpireat(K key, long seconds, ExpireArgs expireArgs, K.. expireArgs.build(args); } - args.add(fields.length); - args.addKeys(fields); + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HEXPIREAT, new IntegerListOutput<>(codec), args); + } + + Command> httl(K key, K... fields) { + keyAndFieldsProvided(key, fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key); + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HTTL, new IntegerListOutput<>(codec), args); + } + + Command> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields) { + keyAndFieldsProvided(key, fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key).add(milliseconds); + + if (expireArgs != null) { + expireArgs.build(args); + } + + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HPEXPIRE, new IntegerListOutput<>(codec), args); + } + + Command> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields) { + keyAndFieldsProvided(key, fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key).add(timestamp); + + if (expireArgs != null) { + expireArgs.build(args); + } + + args.add(FIELDS).add(fields.length).addKeys(fields); - return createCommand(HEXPIREAT, new BooleanOutput<>(codec), args); + return createCommand(HPEXPIREAT, new IntegerListOutput<>(codec), args); + } + + Command> hpexpiretime(K key, K... fields) { + keyAndFieldsProvided(key, fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key); + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HPEXPIRETIME, new IntegerListOutput<>(codec), args); + } + + Command> hpttl(K key, K... fields) { + keyAndFieldsProvided(key, fields); + + CommandArgs args = new CommandArgs<>(codec).addKey(key); + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HPTTL, new IntegerListOutput<>(codec), args); } Command expireat(K key, long timestamp, ExpireArgs expireArgs) { @@ -1029,13 +1080,13 @@ Command expiretime(K key) { return createCommand(EXPIRETIME, new IntegerOutput<>(codec), args); } - Command hexpiretime(K key, K... fields) { + Command> hexpiretime(K key, K... fields) { notNullKey(key); CommandArgs args = new CommandArgs<>(codec).addKey(key); - args.add(fields.length); - args.addKeys(fields); - return createCommand(HEXPIRETIME, new IntegerOutput<>(codec), args); + args.add(FIELDS).add(fields.length).addKeys(fields); + + return createCommand(HEXPIRETIME, new IntegerListOutput<>(codec), args); } Command flushall() { @@ -1402,9 +1453,7 @@ Command getset(K key, V value) { } Command hdel(K key, K... fields) { - notNullKey(key); - LettuceAssert.notNull(fields, "Fields " + MUST_NOT_BE_NULL); - LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + keyAndFieldsProvided(key, fields); CommandArgs args = new CommandArgs<>(codec).addKey(key).addKeys(fields); return createCommand(HDEL, new IntegerOutput<>(codec), args); @@ -1496,18 +1545,15 @@ Command hlen(K key) { } Command> hmget(K key, K... fields) { - notNullKey(key); - LettuceAssert.notNull(fields, "Fields " + MUST_NOT_BE_NULL); - LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + keyAndFieldsProvided(key, fields); CommandArgs args = new CommandArgs<>(codec).addKey(key).addKeys(fields); return createCommand(HMGET, new ValueListOutput<>(codec), args); } Command hmget(ValueStreamingChannel channel, K key, K... fields) { - notNullKey(key); - LettuceAssert.notNull(fields, "Fields " + MUST_NOT_BE_NULL); - LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + keyAndFieldsProvided(key, fields); + notNull(channel); CommandArgs args = new CommandArgs<>(codec).addKey(key).addKeys(fields); @@ -1515,9 +1561,8 @@ Command hmget(ValueStreamingChannel channel, K key, K... fields) } Command hmget(KeyValueStreamingChannel channel, K key, K... fields) { - notNullKey(key); - LettuceAssert.notNull(fields, "Fields " + MUST_NOT_BE_NULL); - LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + keyAndFieldsProvided(key, fields); + notNull(channel); CommandArgs args = new CommandArgs<>(codec).addKey(key).addKeys(fields); @@ -1525,9 +1570,7 @@ Command hmget(KeyValueStreamingChannel channel, K key, K... fi } Command>> hmgetKeyValue(K key, K... fields) { - notNullKey(key); - LettuceAssert.notNull(fields, "Fields " + MUST_NOT_BE_NULL); - LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + keyAndFieldsProvided(key, fields); CommandArgs args = new CommandArgs<>(codec).addKey(key).addKeys(fields); return createCommand(HMGET, new KeyValueListOutput<>(codec, Arrays.asList(fields)), args); @@ -2084,14 +2127,13 @@ Command persist(K key) { return createCommand(PERSIST, new BooleanOutput<>(codec), key); } - Command hpersist(K key, K... fields) { + Command> hpersist(K key, K... fields) { notNullKey(key); CommandArgs args = new CommandArgs<>(codec).addKey(key); - args.add(fields.length); - args.addKeys(fields); + args.add(FIELDS).add(fields.length).addKeys(fields); - return createCommand(HPERSIST, new BooleanOutput<>(codec), args); + return createCommand(HPERSIST, new IntegerListOutput<>(codec), args); } Command pexpire(K key, long milliseconds, ExpireArgs expireArgs) { @@ -4504,6 +4546,11 @@ private static void notNullKey(Object key) { LettuceAssert.notNull(key, "Key " + MUST_NOT_BE_NULL); } + private static void keyAndFieldsProvided(Object key, Object[] fields) { + LettuceAssert.notNull(key, "Key " + MUST_NOT_BE_NULL); + LettuceAssert.notEmpty(fields, "Fields " + MUST_NOT_BE_EMPTY); + } + private static void notNullLimit(Limit limit) { LettuceAssert.notNull(limit, "Limit " + MUST_NOT_BE_NULL); } diff --git a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java index 374f9e2348..209d6c469f 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java @@ -442,11 +442,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpire(K key, long seconds, K... fields); + RedisFuture> hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -455,11 +457,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + RedisFuture> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -467,11 +471,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpire(K key, Duration seconds, K... fields); + RedisFuture> hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -480,11 +486,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + RedisFuture> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -492,11 +500,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, long timestamp, K... fields); + RedisFuture> hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -505,11 +515,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + RedisFuture> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -517,11 +529,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, Date timestamp, K... fields); + RedisFuture> hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -530,11 +544,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + RedisFuture> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -542,11 +558,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, Instant timestamp, K... fields); + RedisFuture> hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -555,33 +573,215 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + RedisFuture> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - RedisFuture hexpiretime(K key, K... fields); + RedisFuture> hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + RedisFuture> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + RedisFuture> hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + RedisFuture> httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - RedisFuture hpersist(K key, K... fields); + RedisFuture> hpttl(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java index bd90160ede..6530b775b2 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java @@ -204,8 +204,6 @@ public interface RedisHashReactiveCommands { * Return a random field along its value from the hash stored at {@code key}. * * @param key the key. - * @param count the number of fields to return. If the provided count argument is positive, return an array of distinct - * fields. * @return array-reply the key and value. * @since 6.1 */ @@ -474,11 +472,13 @@ public interface RedisHashReactiveCommands { * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpire(K key, long seconds, K... fields); + Flux hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -487,11 +487,13 @@ public interface RedisHashReactiveCommands { * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + Flux hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -499,11 +501,13 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpire(K key, Duration seconds, K... fields); + Flux hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -512,11 +516,13 @@ public interface RedisHashReactiveCommands { * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + Flux hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -524,11 +530,13 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, long timestamp, K... fields); + Flux hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -537,11 +545,13 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + Flux hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -549,11 +559,13 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, Date timestamp, K... fields); + Flux hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -562,11 +574,13 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + Flux hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -574,11 +588,13 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, Instant timestamp, K... fields); + Flux hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -587,33 +603,215 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + Flux hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - Mono hexpiretime(K key, K... fields); + Flux hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Flux hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + Flux hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Flux httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - Mono hpersist(K key, K... fields); + Flux hpttl(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java index f27d96e0c6..6345f8593f 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java @@ -194,8 +194,6 @@ public interface RedisHashCommands { * Return a random field along its value from the hash stored at {@code key}. * * @param key the key. - * @param count the number of fields to return. If the provided count argument is positive, return an array of distinct - * fields. * @return array-reply the key and value. * @since 6.1 */ @@ -441,11 +439,13 @@ public interface RedisHashCommands { * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, long seconds, K... fields); + List hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -454,11 +454,13 @@ public interface RedisHashCommands { * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + List hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -466,11 +468,13 @@ public interface RedisHashCommands { * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, Duration seconds, K... fields); + List hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -479,11 +483,13 @@ public interface RedisHashCommands { * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + List hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -491,11 +497,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, long timestamp, K... fields); + List hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -504,11 +512,13 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -516,11 +526,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Date timestamp, K... fields); + List hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -529,11 +541,13 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -541,11 +555,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Instant timestamp, K... fields); + List hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -554,33 +570,215 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - Long hexpiretime(K key, K... fields); + List hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + List hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + List httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - Boolean hpersist(K key, K... fields); + List hpttl(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java index 4b020c3663..3dbf6b2af6 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java @@ -441,11 +441,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpire(K key, long seconds, K... fields); + AsyncExecutions> hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -454,11 +456,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + AsyncExecutions> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -466,11 +470,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpire(K key, Duration seconds, K... fields); + AsyncExecutions> hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -479,11 +485,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + AsyncExecutions> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -491,11 +499,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, long timestamp, K... fields); + AsyncExecutions> hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -504,11 +514,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + AsyncExecutions> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -516,11 +528,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, Date timestamp, K... fields); + AsyncExecutions> hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -529,11 +543,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + AsyncExecutions> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -541,11 +557,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, Instant timestamp, K... fields); + AsyncExecutions> hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -554,33 +572,215 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + AsyncExecutions> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - AsyncExecutions hexpiretime(K key, K... fields); + AsyncExecutions> hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + AsyncExecutions> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + AsyncExecutions> hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + AsyncExecutions> httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - AsyncExecutions hpersist(K key, K... fields); + AsyncExecutions> hpttl(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java index 9f23a2159d..ee344d1180 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java @@ -439,11 +439,13 @@ public interface NodeSelectionHashCommands { * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpire(K key, long seconds, K... fields); + Executions> hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -452,11 +454,13 @@ public interface NodeSelectionHashCommands { * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + Executions> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -464,11 +468,13 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpire(K key, Duration seconds, K... fields); + Executions> hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -477,11 +483,13 @@ public interface NodeSelectionHashCommands { * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + Executions> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -489,11 +497,13 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, long timestamp, K... fields); + Executions> hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -502,11 +512,13 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + Executions> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -514,11 +526,13 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, Date timestamp, K... fields); + Executions> hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -527,11 +541,13 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + Executions> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -539,11 +555,13 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, Instant timestamp, K... fields); + Executions> hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -552,33 +570,215 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + Executions> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - Executions hexpiretime(K key, K... fields); + Executions> hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + Executions> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + Executions> hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + Executions> httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - Executions hpersist(K key, K... fields); + Executions> hpttl(K key, K... fields); } diff --git a/src/main/java/io/lettuce/core/output/IntegerListOutput.java b/src/main/java/io/lettuce/core/output/IntegerListOutput.java index d23acd8dc6..a92a895fdc 100644 --- a/src/main/java/io/lettuce/core/output/IntegerListOutput.java +++ b/src/main/java/io/lettuce/core/output/IntegerListOutput.java @@ -1,11 +1,12 @@ package io.lettuce.core.output; -import java.util.Collections; -import java.util.List; - import io.lettuce.core.codec.RedisCodec; import io.lettuce.core.internal.LettuceAssert; +import java.nio.ByteBuffer; +import java.util.Collections; +import java.util.List; + /** * {@link List} of 64-bit integer output. * @@ -30,6 +31,16 @@ public void set(long integer) { subscriber.onNext(output, integer); } + @Override + public void set(ByteBuffer bytes) { + // nil results should produce an empty list + if (bytes == null) { + return; + } + + super.set(bytes); + } + @Override public void multi(int count) { diff --git a/src/main/java/io/lettuce/core/protocol/CommandKeyword.java b/src/main/java/io/lettuce/core/protocol/CommandKeyword.java index 1d8f7266ab..6e1af5429f 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandKeyword.java +++ b/src/main/java/io/lettuce/core/protocol/CommandKeyword.java @@ -37,7 +37,7 @@ public enum CommandKeyword implements ProtocolKeyword { BY, BYLEX, BYSCORE, CACHING, CAT, CH, CHANNELS, COPY, COUNT, COUNTKEYSINSLOT, CONSUMERS, CREATE, DB, DELSLOTS, DELSLOTSRANGE, DELUSER, DESC, DRYRUN, SOFT, HARD, ENCODING, - FAILOVER, FORGET, FLUSH, FORCE, FREQ, FLUSHSLOTS, GENPASS, GETNAME, GETUSER, GETKEYSINSLOT, GETREDIR, GROUP, GROUPS, HTSTATS, ID, IDLE, INFO, + FAILOVER, FORGET, FIELDS, FLUSH, FORCE, FREQ, FLUSHSLOTS, GENPASS, GETNAME, GETUSER, GETKEYSINSLOT, GETREDIR, GROUP, GROUPS, HTSTATS, ID, IDLE, INFO, IDLETIME, JUSTID, KILL, KEYSLOT, LEFT, LEN, LIMIT, LIST, LOAD, LOG, MATCH, diff --git a/src/main/java/io/lettuce/core/protocol/CommandType.java b/src/main/java/io/lettuce/core/protocol/CommandType.java index 37ae008fb1..427ce80184 100644 --- a/src/main/java/io/lettuce/core/protocol/CommandType.java +++ b/src/main/java/io/lettuce/core/protocol/CommandType.java @@ -46,7 +46,7 @@ public enum CommandType implements ProtocolKeyword { // Keys - COPY, DEL, DUMP, EXISTS, HEXPIRE, EXPIRE, HEXPIREAT, EXPIREAT, HEXPIRETIME, EXPIRETIME, KEYS, MIGRATE, MOVE, OBJECT, HPERSIST, PERSIST, PEXPIRE, PEXPIREAT, PEXPIRETIME, PTTL, RANDOMKEY, RENAME, RENAMENX, RESTORE, TOUCH, TTL, TYPE, SCAN, UNLINK, + COPY, DEL, DUMP, EXISTS, HEXPIRE, EXPIRE, HEXPIREAT, EXPIREAT, HEXPIRETIME, EXPIRETIME, KEYS, MIGRATE, MOVE, OBJECT, HPERSIST, PERSIST, PEXPIRE, HPEXPIRE, PEXPIREAT, HPEXPIREAT, PEXPIRETIME, HPEXPIRETIME, PTTL, HPTTL, RANDOMKEY, RENAME, RENAMENX, RESTORE, TOUCH, TTL, HTTL, TYPE, SCAN, UNLINK, // String diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt index 34a4228f49..99c330a35b 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommands.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020-Present, Redis Ltd. and Contributors + * Copyright 2017-Present, Redis Ltd. and Contributors * All rights reserved. * * Licensed under the MIT License. @@ -313,11 +313,13 @@ interface RedisHashCoroutinesCommands { * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpire(key: K, seconds: Long, vararg fields: K): Boolean? + suspend fun hexpire(key: K, seconds: Long, vararg fields: K): List /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -326,11 +328,13 @@ interface RedisHashCoroutinesCommands { * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? + suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key. @@ -338,11 +342,13 @@ interface RedisHashCoroutinesCommands { * @param key the key. * @param seconds the TTL [Duration] * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): Boolean? + suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key. @@ -351,11 +357,13 @@ interface RedisHashCoroutinesCommands { * @param seconds the TTL [Duration] * @param expireArgs the [ExpireArgs]. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpire(key: K, seconds: Duration, expireArgs: ExpireArgs, vararg fields: K): Boolean? + suspend fun hexpire(key: K, seconds: Duration, expireArgs: ExpireArgs, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -363,11 +371,13 @@ interface RedisHashCoroutinesCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -376,11 +386,13 @@ interface RedisHashCoroutinesCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Long, expireArgs: ExpireArgs, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -388,11 +400,13 @@ interface RedisHashCoroutinesCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -401,11 +415,13 @@ interface RedisHashCoroutinesCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Date, expireArgs: ExpireArgs, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Date, expireArgs: ExpireArgs, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -413,11 +429,13 @@ interface RedisHashCoroutinesCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): List /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -426,34 +444,215 @@ interface RedisHashCoroutinesCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: `true` if the timeout was set. `false` if `key` does not - * exist or the timeout could not be set (see: `EXPIRE`). + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpireat(key: K, timestamp: Instant, expireArgs: ExpireArgs, vararg fields: K): Boolean? + suspend fun hexpireat(key: K, timestamp: Instant, expireArgs: ExpireArgs, vararg fields: K): List /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns `-1` if - * the key exists but has no associated expiration time. The command returns `-2` if the key does not exist. + * @return a list of [Long] values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * `-1` indicating the field has no expiry time set; `-2` indicating there is no such field * @since 7.0 */ - suspend fun hexpiretime(key: K, vararg fields: K): Long? + suspend fun hexpiretime(key: K, vararg fields: K): List /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of [Long] values for each of the fields provided: `1` indicating expiration time is removed; + * `-1` field has no expiration time to be removed; `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpersist(key: K, vararg fields: K): List + + /** + * Set the time to live for one or more fields in milliseconds. * - * `true` if the timeout was removed. `false` if `key` does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpire(key: K, milliseconds: Long, vararg fields: K): List + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpire(key: K, milliseconds: Long, expireArgs: ExpireArgs, vararg fields: K): List + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpire(key: K, milliseconds: Duration, vararg fields: K): List + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpire(key: K, milliseconds: Duration, expireArgs: ExpireArgs, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Long, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Long, expireArgs: ExpireArgs, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Date, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Date, expireArgs: ExpireArgs, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Instant, vararg fields: K): List + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of [Long] values for each of the fields provided: `2` indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; `1` indicating expiration time is + * set/updated; `0` indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpireat(key: K, timestamp: Instant, expireArgs: ExpireArgs, vararg fields: K): List + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of [Long] values for each of the fields provided: expiration time as a UNIX timestamp in milliseconds; + * `-1` indicating the field has no expiry time set; `-2` indicating there is no such field + * @since 7.0 + */ + suspend fun hpexpiretime(key: K, vararg fields: K): List + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of [Long] values for each of the fields provided: the time to live in seconds; or a negative value in + * order to signal an error. The command returns `-1` if the key exists but has no associated expiration time. + * The command returns `-2` if the key does not exist. + * @since 7.0 + */ + suspend fun httl(key: K, vararg fields: K): List + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of [Long] values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns `-1` if the key exists but has no associated + * expiration time. The command returns `-2` if the key does not exist. + * @since 7.0 */ - suspend fun hpersist(key: K, vararg fields: K): Boolean? + suspend fun hpttl(key: K, vararg fields: K): List } diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt index 8a1d959e54..23231b5f5b 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisHashCoroutinesCommandsImpl.kt @@ -116,60 +116,123 @@ internal class RedisHashCoroutinesCommandsImpl(internal val op override fun hvals(key: K): Flow = ops.hvals(key).asFlow() - override suspend fun hexpire(key: K, seconds: Long, vararg fields: K): Boolean? = - ops.hexpire(key, seconds, *fields).awaitFirstOrNull() + override suspend fun hexpire(key: K, seconds: Long, vararg fields: K): List = + ops.hexpire(key, seconds, *fields).asFlow().toList() - override suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): Boolean? = - ops.hexpire(key, seconds, expireArgs, *fields).awaitFirstOrNull() + override suspend fun hexpire(key: K, seconds: Long, expireArgs: ExpireArgs, vararg fields: K): List = + ops.hexpire(key, seconds, expireArgs, *fields).asFlow().toList() - override suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): Boolean? = - ops.hexpire(key, seconds, *fields).awaitFirstOrNull() + override suspend fun hexpire(key: K, seconds: Duration, vararg fields: K): List = + ops.hexpire(key, seconds, *fields).asFlow().toList() override suspend fun hexpire( key: K, seconds: Duration, expireArgs: ExpireArgs, vararg fields: K - ): Boolean? = - ops.hexpire(key, seconds, expireArgs, *fields).awaitFirstOrNull() + ): List = + ops.hexpire(key, seconds, expireArgs, *fields).asFlow().toList() - override suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): Boolean? = - ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + override suspend fun hexpireat(key: K, timestamp: Date, vararg fields: K): List = + ops.hexpireat(key, timestamp, *fields).asFlow().toList() override suspend fun hexpireat( key: K, timestamp: Long, expireArgs: ExpireArgs, vararg fields: K - ): Boolean? = - ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + ): List = + ops.hexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() - override suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): Boolean? = - ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + override suspend fun hexpireat(key: K, timestamp: Instant, vararg fields: K): List = + ops.hexpireat(key, timestamp, *fields).asFlow().toList() override suspend fun hexpireat( key: K, timestamp: Instant, expireArgs: ExpireArgs, vararg fields: K - ): Boolean? = - ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + ): List = + ops.hexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() - override suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): Boolean? = - ops.hexpireat(key, timestamp, *fields).awaitFirstOrNull() + override suspend fun hexpireat(key: K, timestamp: Long, vararg fields: K): List = + ops.hexpireat(key, timestamp, *fields).asFlow().toList() override suspend fun hexpireat( key: K, timestamp: Date, expireArgs: ExpireArgs, vararg fields: K - ): Boolean? = - ops.hexpireat(key, timestamp, expireArgs, *fields).awaitFirstOrNull() + ): List = + ops.hexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() - override suspend fun hexpiretime(key: K, vararg fields: K): Long? = - ops.hexpiretime(key).awaitFirstOrNull() + override suspend fun hexpiretime(key: K, vararg fields: K): List = + ops.hexpiretime(key).asFlow().toList() - override suspend fun hpersist(key: K, vararg fields: K): Boolean? = ops.hpersist(key).awaitFirstOrNull() + override suspend fun hpersist(key: K, vararg fields: K): List = ops.hpersist(key).asFlow().toList() + override suspend fun hpexpire(key: K, milliseconds: Long, vararg fields: K): List = + ops.hpexpire(key, milliseconds, *fields).asFlow().toList() + + override suspend fun hpexpire( + key: K, + milliseconds: Long, + expireArgs: ExpireArgs, + vararg fields: K + ): List = + ops.hpexpire(key, milliseconds, expireArgs, *fields).asFlow().toList() + + override suspend fun hpexpire(key: K, milliseconds: Duration, vararg fields: K): List = + ops.hpexpire(key, milliseconds, *fields).asFlow().toList() + + override suspend fun hpexpire( + key: K, + milliseconds: Duration, + expireArgs: ExpireArgs, + vararg fields: K + ): List = + ops.hpexpire(key, milliseconds, expireArgs, *fields).asFlow().toList() + + override suspend fun hpexpireat(key: K, timestamp: Long, vararg fields: K): List = + ops.hpexpireat(key, timestamp, *fields).asFlow().toList() + + override suspend fun hpexpireat( + key: K, + timestamp: Long, + expireArgs: ExpireArgs, + vararg fields: K + ): List = + ops.hpexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() + + override suspend fun hpexpireat(key: K, timestamp: Date, vararg fields: K): List = + ops.hpexpireat(key, timestamp, *fields).asFlow().toList() + + override suspend fun hpexpireat( + key: K, + timestamp: Date, + expireArgs: ExpireArgs, + vararg fields: K + ): List = + ops.hpexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() + + override suspend fun hpexpireat(key: K, timestamp: Instant, vararg fields: K): List = + ops.hpexpireat(key, timestamp, *fields).asFlow().toList() + + override suspend fun hpexpireat( + key: K, + timestamp: Instant, + expireArgs: ExpireArgs, + vararg fields: K + ): List = + ops.hpexpireat(key, timestamp, expireArgs, *fields).asFlow().toList() + + override suspend fun hpexpiretime(key: K, vararg fields: K): List = + ops.hpexpiretime(key, *fields).asFlow().toList() + + override suspend fun httl(key: K, vararg fields: K): List = + ops.httl(key, *fields).asFlow().toList() + + override suspend fun hpttl(key: K, vararg fields: K): List = + ops.hpttl(key, *fields).asFlow().toList() } diff --git a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java index 53896d05a7..4d44cc2979 100644 --- a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java @@ -434,11 +434,13 @@ public interface RedisHashCommands { * @param key the key of the fields. * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, long seconds, K... fields); + List hexpire(K key, long seconds, K... fields); /** * Set the time to live (in seconds) for one or more fields, belonging to a certain key. @@ -447,11 +449,13 @@ public interface RedisHashCommands { * @param seconds the seconds type: long. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); + List hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -459,11 +463,13 @@ public interface RedisHashCommands { * @param key the key. * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, Duration seconds, K... fields); + List hexpire(K key, Duration seconds, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key. @@ -472,11 +478,13 @@ public interface RedisHashCommands { * @param seconds the TTL {@link Duration} * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); + List hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -484,11 +492,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, long timestamp, K... fields); + List hexpireat(K key, long timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -497,11 +507,13 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -509,11 +521,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Date timestamp, K... fields); + List hexpireat(K key, Date timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -522,11 +536,13 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -534,11 +550,13 @@ public interface RedisHashCommands { * @param key the key. * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Instant timestamp, K... fields); + List hexpireat(K key, Instant timestamp, K... fields); /** * Set the time to live for one or more fields, belonging to a certain key as a UNIX timestamp. @@ -547,33 +565,215 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param expireArgs the expire arguments. * @param fields one or more fields to set the TTL for. - * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not - * exist or the timeout could not be set (see: {@code EXPIRE}). + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field * @since 7.0 */ - Boolean hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + List hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); /** - * Get the time to live for one or more fields in as unix timestamp in seconds. + * Get the time to live for one or more fields in as UNIX timestamp in seconds. * * @param key the key. * @param fields one or more fields to get the TTL for. - * @return Long integer-reply in seconds, or a negative value in order to signal an error. The command returns {@code -1} if - * the key exists but has no associated expiration time. The command returns {@code -2} if the key does not exist. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; + * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field * @since 7.0 */ - Long hexpiretime(K key, K... fields); + List hexpiretime(K key, K... fields); /** * Remove the expiration from one or more fields. * * @param key the key. * @param fields one or more fields to remove the TTL for. - * @return Boolean integer-reply specifically: + * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; + * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpersist(K key, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. * - * {@code true} if the timeout was removed. {@code false} if {@code key} does not exist or does not have an - * associated timeout. + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, long milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds type: long. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, Duration milliseconds, K... fields); + + /** + * Set the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param milliseconds the milliseconds. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, long timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Date timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Instant timestamp, K... fields); + + /** + * Set the time to live for one or more fields as a UNIX timestamp specified in milliseconds. + * + * @param key the key. + * @param timestamp the milliseconds-timestamp type: posix time. + * @param expireArgs the expire arguments. + * @param fields one or more fields to set the TTL for. + * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted + * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not + * met); {@code -2} indicating there is no such field + * @since 7.0 + */ + List hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); + + /** + * Get the time to live for one or more fields as UNIX timestamp in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in + * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such + * field + * @since 7.0 + */ + List hpexpiretime(K key, K... fields); + + /** + * Get the time to live for one or more fields. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value + * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration + * time. The command returns {@code -2} if the key does not exist. + * @since 7.0 + */ + List httl(K key, K... fields); + + /** + * Get the time to live for one or more fields in milliseconds. + * + * @param key the key. + * @param fields one or more fields to get the TTL for. + * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative + * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated + * expiration time. The command returns {@code -2} if the key does not exist. + * @since 7.0 */ - Boolean hpersist(K key, K... fields); + List hpttl(K key, K... fields); } diff --git a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java index b29d81ad21..5e6eba1939 100644 --- a/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java +++ b/src/test/java/io/lettuce/core/RedisCommandBuilderUnitTests.java @@ -44,9 +44,9 @@ void shouldCorrectlyConstructHexpire() { ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo( - "*8\r\n" + "$7\r\n" + "HEXPIRE\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" - + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*9\r\n" + "$7\r\n" + "HEXPIRE\r\n" + "$4\r\n" + "hKey\r\n" + + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test @@ -56,9 +56,9 @@ void shouldCorrectlyConstructHexpireat() { ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo( - "*8\r\n" + "$9\r\n" + "HEXPIREAT\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" - + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*9\r\n" + "$9\r\n" + "HEXPIREAT\r\n" + "$4\r\n" + "hKey\r\n" + + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test @@ -69,8 +69,8 @@ void shouldCorrectlyConstructHexpiretime() { command.encode(buf); assertThat(buf.toString(StandardCharsets.UTF_8)) - .isEqualTo("*6\r\n" + "$11\r\n" + "HEXPIRETIME\r\n" + "$4\r\n" + "hKey\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" - + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + .isEqualTo("*7\r\n" + "$11\r\n" + "HEXPIRETIME\r\n" + "$4\r\n" + "hKey\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } @Test @@ -80,8 +80,70 @@ void shouldCorrectlyConstructHpersist() { ByteBuf buf = Unpooled.directBuffer(); command.encode(buf); - assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*6\r\n" + "$8\r\n" + "HPERSIST\r\n" + "$4\r\n" + "hKey\r\n" - + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + assertThat(buf.toString(StandardCharsets.UTF_8)) + .isEqualTo("*7\r\n" + "$8\r\n" + "HPERSIST\r\n" + "$4\r\n" + "hKey\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHpexpire() { + + Command command = sut.hpexpire(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*9\r\n" + "$8\r\n" + "HPEXPIRE\r\n" + "$4\r\n" + "hKey\r\n" + + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + "3\r\n" + "$7\r\n" + + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHpexpireat() { + + Command command = sut.hpexpireat(MY_KEY, 1, ExpireArgs.Builder.nx(), MY_FIELD1, MY_FIELD2, + MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)).isEqualTo("*9\r\n" + "$10\r\n" + "HPEXPIREAT\r\n" + "$4\r\n" + + "hKey\r\n" + "$1\r\n" + "1\r\n" + "$2\r\n" + "NX\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + "3\r\n" + + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHpexpiretime() { + + Command command = sut.hpexpiretime(MY_KEY, MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)) + .isEqualTo("*7\r\n" + "$12\r\n" + "HPEXPIRETIME\r\n" + "$4\r\n" + "hKey\r\n" + "$6\r\n" + "FIELDS\r\n" + + "$1\r\n" + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHttl() { + + Command command = sut.httl(MY_KEY, MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)) + .isEqualTo("*7\r\n" + "$4\r\n" + "HTTL\r\n" + "$4\r\n" + "hKey\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); + } + + @Test + void shouldCorrectlyConstructHpttl() { + + Command command = sut.hpttl(MY_KEY, MY_FIELD1, MY_FIELD2, MY_FIELD3); + ByteBuf buf = Unpooled.directBuffer(); + command.encode(buf); + + assertThat(buf.toString(StandardCharsets.UTF_8)) + .isEqualTo("*7\r\n" + "$5\r\n" + "HPTTL\r\n" + "$4\r\n" + "hKey\r\n" + "$6\r\n" + "FIELDS\r\n" + "$1\r\n" + + "3\r\n" + "$7\r\n" + "hField1\r\n" + "$7\r\n" + "hField2\r\n" + "$7\r\n" + "hField3\r\n"); } } diff --git a/src/test/java/io/lettuce/core/SslIntegrationTests.java b/src/test/java/io/lettuce/core/SslIntegrationTests.java index cee9db988a..e9d6c1cd67 100644 --- a/src/test/java/io/lettuce/core/SslIntegrationTests.java +++ b/src/test/java/io/lettuce/core/SslIntegrationTests.java @@ -19,27 +19,6 @@ */ package io.lettuce.core; -import static io.lettuce.test.settings.TestSettings.*; -import static org.assertj.core.api.Assertions.*; -import static org.junit.jupiter.api.Assumptions.*; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.time.Duration; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import javax.inject.Inject; - -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - import io.lettuce.core.api.StatefulRedisConnection; import io.lettuce.core.api.sync.RedisCommands; import io.lettuce.core.codec.StringCodec; @@ -52,6 +31,26 @@ import io.lettuce.test.Wait; import io.lettuce.test.settings.TestSettings; import io.netty.handler.ssl.OpenSsl; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import javax.inject.Inject; +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; +import java.time.Duration; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static io.lettuce.test.settings.TestSettings.sslPort; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assumptions.assumeTrue; /** * Tests using SSL via {@link RedisClient}. @@ -382,6 +381,9 @@ void masterSlaveSslWithAllInvalidHostsWillFail() { } @Test + @Disabled + // This test is frequently failing on the pipeline and passing locally, so is considered very unstable + // The 120 seconds timeout used to stabilize it somewhat, but no longer void pubSubSsl() { RedisPubSubCommands connection = redisClient.connectPubSub(URI_NO_VERIFY).sync(); diff --git a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java index e6431f97a7..f6148209c6 100644 --- a/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/HashCommandIntegrationTests.java @@ -32,7 +32,6 @@ import io.lettuce.test.LettuceExtension; import io.lettuce.test.ListStreamingAdapter; import io.lettuce.test.condition.EnabledOnCommand; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; @@ -68,6 +67,8 @@ public class HashCommandIntegrationTests extends TestSupport { public static final String MY_FIELD = "hField"; + public static final String MY_SECOND_FIELD = "hSecondField"; + public static final String MY_VALUE = "hValue"; private final RedisCommands redis; @@ -82,13 +83,6 @@ void setUp() { this.redis.flushall(); } - @AfterEach - void tearDown() { - // resets the configuration settings to default, would not be needed once listpack is supported - assertThat(redis.configSet("hash-max-listpack-entries", "512")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "64")).isEqualTo("OK"); - } - @Test void hdel() { assertThat(redis.hdel(key, "one")).isEqualTo(0); @@ -562,13 +556,11 @@ void hscanNoValuesMatch() { @Test @EnabledOnCommand("HEXPIRE") void hexpire() { - // the below settings are required until the solution is able to support listpack entries - // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); - assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).isTrue(); + assertThat(redis.hexpire(MY_KEY, 0, MY_FIELD)).containsExactly(2L); + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD, MY_SECOND_FIELD)).containsExactly(1L, -2L); + assertThat(redis.hexpire("invalidKey", 1, MY_FIELD)).isEmpty(); await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); } @@ -576,16 +568,11 @@ void hexpire() { @Test @EnabledOnCommand("HEXPIRE") void hexpireExpireArgs() { - // the below settings are required until the solution is able to support listpack entries - // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); - assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.nx(), MY_FIELD)).isTrue(); - assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.xx(), MY_FIELD)).isTrue(); - assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(10), ExpireArgs.Builder.gt(), MY_FIELD)).isTrue(); - assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.lt(), MY_FIELD)).isTrue(); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.nx(), MY_FIELD)).containsExactly(1L); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.xx(), MY_FIELD)).containsExactly(1L); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(10), ExpireArgs.Builder.gt(), MY_FIELD)).containsExactly(1L); + assertThat(redis.hexpire(MY_KEY, Duration.ofSeconds(1), ExpireArgs.Builder.lt(), MY_FIELD)).containsExactly(1L); await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); } @@ -593,13 +580,11 @@ void hexpireExpireArgs() { @Test @EnabledOnCommand("HEXPIREAT") void hexpireat() { - // the below settings are required until the solution is able to support listpack entries - // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); - assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hexpireat(MY_KEY, Instant.now().plusSeconds(1), MY_FIELD)).isTrue(); + assertThat(redis.hexpireat(MY_KEY, Instant.now().minusSeconds(1), MY_FIELD)).containsExactly(2L); + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpireat(MY_KEY, Instant.now().plusSeconds(1), MY_FIELD)).containsExactly(1L); + assertThat(redis.hexpireat("invalidKey", Instant.now().plusSeconds(1), MY_FIELD)).isEmpty(); await().until(() -> redis.hget(MY_KEY, MY_FIELD) == null); } @@ -607,31 +592,40 @@ void hexpireat() { @Test @EnabledOnCommand("HEXPIRETIME") void hexpiretime() { - Date expiration = new Date(System.currentTimeMillis() + 10000); - // the below settings are required until the solution is able to support listpack entries - // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); + Map fields = new LinkedHashMap<>(); + fields.put(MY_FIELD, MY_VALUE); + fields.put(MY_SECOND_FIELD, MY_VALUE); - assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hexpireat(MY_KEY, expiration, MY_FIELD)).isTrue(); + Date expiration = new Date(System.currentTimeMillis() + 1000 * 5); + Date secondExpiration = new Date(System.currentTimeMillis() + 1000 * 10); + assertThat(redis.hset(MY_KEY, fields)).isEqualTo(2); + assertThat(redis.hexpireat(MY_KEY, expiration, MY_FIELD)).containsExactly(1L); + assertThat(redis.hexpireat(MY_KEY, secondExpiration, MY_SECOND_FIELD)).containsExactly(1L); - assertThat(redis.hexpiretime(MY_KEY, MY_FIELD)).isEqualTo(expiration.getTime() / 1000); + assertThat(redis.hexpiretime(MY_KEY, MY_FIELD, MY_SECOND_FIELD)).containsExactly(expiration.getTime() / 1000, + secondExpiration.getTime() / 1000); } @Test @EnabledOnCommand("HPERSIST") - void persist() { - // the below settings are required until the solution is able to support listpack entries - // see TODOs in https://github.com/redis/redis/pull/13172 for more details - assertThat(redis.configSet("hash-max-listpack-entries", "0")).isEqualTo("OK"); - assertThat(redis.configSet("set-max-listpack-value", "0")).isEqualTo("OK"); + void hpersist() { + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isEmpty(); + + assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).containsExactly(-1L); + + assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).containsExactly(1L); - assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isFalse(); + assertThat(redis.hpersist(MY_KEY, MY_FIELD)).containsExactly(1L); + } + + @Test + @EnabledOnCommand("HTTL") + void httl() { assertThat(redis.hset(MY_KEY, MY_FIELD, MY_VALUE)).isTrue(); - assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isFalse(); - assertThat(redis.hexpire(MY_KEY, 1, MY_FIELD)).isTrue(); - assertThat(redis.hpersist(MY_KEY, MY_FIELD)).isTrue(); + assertThat(redis.hset(MY_KEY, MY_SECOND_FIELD, MY_VALUE)).isTrue(); + assertThat(redis.hexpire(MY_KEY, 60, MY_FIELD)).containsExactly(1L); + assertThat(redis.httl(MY_KEY, MY_FIELD, MY_SECOND_FIELD)).containsExactly(60L, -1L); } void setup100KeyValues(Map expect) { diff --git a/src/test/java/io/lettuce/core/output/IntegerListOutputUnitTests.java b/src/test/java/io/lettuce/core/output/IntegerListOutputUnitTests.java new file mode 100644 index 0000000000..4ed64548c4 --- /dev/null +++ b/src/test/java/io/lettuce/core/output/IntegerListOutputUnitTests.java @@ -0,0 +1,103 @@ +package io.lettuce.core.output; + +import io.lettuce.core.codec.StringCodec; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +/** + * @author Tihomir Mateev + */ +class IntegerListOutputUnitTests { + + static Collection parameters() { + + IntegerListOutput integerListOutput = new IntegerListOutput<>(StringCodec.UTF8); + Fixture integerList = new Fixture(integerListOutput, integerListOutput, + ByteBuffer.allocate(Long.SIZE / Byte.SIZE).putLong(1L).array(), 1L); + + IntegerListOutput nullListOutput = new IntegerListOutput<>(StringCodec.UTF8); + Fixture nullList = new Fixture(nullListOutput, nullListOutput, null, null); + + ValueListOutput valueListOutput = new ValueListOutput<>(StringCodec.UTF8); + Fixture valueList = new Fixture(valueListOutput, valueListOutput, "hello world".getBytes(), "hello world"); + + StringListOutput stringListOutput = new StringListOutput<>(StringCodec.UTF8); + Fixture stringList = new Fixture(stringListOutput, stringListOutput, "hello world".getBytes(), "hello world"); + + return Arrays.asList(integerList, nullList, valueList, stringList); + } + + @ParameterizedTest + @MethodSource("parameters") + void settingEmptySubscriberShouldFail(Fixture fixture) { + assertThatThrownBy(() -> fixture.streamingOutput.setSubscriber(null)).isInstanceOf(IllegalArgumentException.class); + } + + @ParameterizedTest + @MethodSource("parameters") + void defaultSubscriberIsSet(Fixture fixture) { + fixture.commandOutput.multi(1); + assertThat(fixture.streamingOutput.getSubscriber()).isNotNull().isInstanceOf(ListSubscriber.class); + } + + @ParameterizedTest + @MethodSource("parameters") + void setIntegerShouldFail(Fixture fixture) { + assertThatThrownBy(() -> fixture.commandOutput.set(123L)).isInstanceOf(UnsupportedOperationException.class); + } + + @ParameterizedTest + @MethodSource("parameters") + void setValueShouldConvert(Fixture fixture) { + + fixture.commandOutput.multi(1); + + if (fixture.valueBytes == null) { + fixture.commandOutput.set(null); + } else if (fixture.value instanceof Long) { + fixture.commandOutput.set((Long) fixture.value); + } else { + fixture.commandOutput.set(ByteBuffer.wrap(fixture.valueBytes)); + } + + if (fixture.valueBytes != null) { + assertThat(fixture.commandOutput.get()).contains(fixture.value); + } else { + assertThat(fixture.commandOutput.get()).isEmpty(); + } + } + + static class Fixture { + + final CommandOutput> commandOutput; + + final StreamingOutput streamingOutput; + + final byte[] valueBytes; + + final Object value; + + Fixture(CommandOutput commandOutput, StreamingOutput streamingOutput, byte[] valueBytes, Object value) { + + this.commandOutput = (CommandOutput) commandOutput; + this.streamingOutput = streamingOutput; + this.valueBytes = valueBytes; + this.value = value; + } + + @Override + public String toString() { + return commandOutput.getClass().getSimpleName() + "/" + value; + } + + } + +} From 5612e29509889f85b4791ff1baf6b9b067ddf7ed Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Tue, 28 May 2024 14:09:56 +0300 Subject: [PATCH 15/28] XREAD support for reading last message from stream (#2863) * Add last() utility method to the XArgs.StreamOffset * Submitted one more file by mistake --- src/main/java/io/lettuce/core/XReadArgs.java | 21 ++++++- .../StreamCommandIntegrationTests.java | 55 ++++++++++++------- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/main/java/io/lettuce/core/XReadArgs.java b/src/main/java/io/lettuce/core/XReadArgs.java index 13d0b4938d..c08338e2dd 100644 --- a/src/main/java/io/lettuce/core/XReadArgs.java +++ b/src/main/java/io/lettuce/core/XReadArgs.java @@ -1,11 +1,11 @@ package io.lettuce.core; -import java.time.Duration; - import io.lettuce.core.internal.LettuceAssert; import io.lettuce.core.protocol.CommandArgs; import io.lettuce.core.protocol.CommandKeyword; +import java.time.Duration; + /** * Argument list builder for the Redis XREAD and {@literal XREADGROUP} commands. * Static import the methods from {@link XReadArgs.Builder} and call the methods: {@code block(…)} . @@ -171,7 +171,7 @@ private StreamOffset(K name, String offset) { } /** - * Read all new arriving elements from the stream identified by {@code name}. + * Read all new arriving elements from the stream identified by {@code name} excluding any elements before this call * * @param name must not be {@code null}. * @return the {@link StreamOffset} object without a specific offset. @@ -183,6 +183,21 @@ public static StreamOffset latest(K name) { return new StreamOffset<>(name, "$"); } + /** + * Read all new arriving elements from the stream identified by {@code name} including the last element added before + * this call + * + * @param name must not be {@code null}. + * @return the {@link StreamOffset} object without a specific offset. + * @since 7.0 + */ + public static StreamOffset last(K name) { + + LettuceAssert.notNull(name, "Stream must not be null"); + + return new StreamOffset<>(name, "+"); + } + /** * Read all new arriving elements from the stream identified by {@code name} with ids greater than the last one consumed * by the consumer group. diff --git a/src/test/java/io/lettuce/core/commands/StreamCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/StreamCommandIntegrationTests.java index 2216955d4d..0a4b233a9c 100644 --- a/src/test/java/io/lettuce/core/commands/StreamCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/StreamCommandIntegrationTests.java @@ -19,25 +19,6 @@ */ package io.lettuce.core.commands; -import static io.lettuce.core.protocol.CommandType.*; -import static org.assertj.core.api.Assertions.*; - -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.inject.Inject; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExtendWith; - import io.lettuce.core.*; import io.lettuce.core.XReadArgs.StreamOffset; import io.lettuce.core.api.sync.RedisCommands; @@ -49,6 +30,23 @@ import io.lettuce.core.protocol.CommandArgs; import io.lettuce.test.LettuceExtension; import io.lettuce.test.condition.EnabledOnCommand; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; + +import javax.inject.Inject; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static io.lettuce.core.protocol.CommandType.XINFO; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for {@link io.lettuce.core.api.sync.RedisStreamCommands}. @@ -316,7 +314,7 @@ public void xreadTransactional() { redis.multi(); redis.xadd("stream-1", Collections.singletonMap("key3", "value3")); redis.xadd("stream-2", Collections.singletonMap("key4", "value4")); - redis.xread(StreamOffset.from("stream-1", initial1), XReadArgs.StreamOffset.from("stream-2", initial2)); + redis.xread(StreamOffset.from("stream-1", initial1), StreamOffset.from("stream-2", initial2)); TransactionResult exec = redis.exec(); @@ -337,6 +335,23 @@ public void xreadTransactional() { assertThat(secondMessage.getBody()).containsEntry("key4", "value4"); } + @Test + public void xreadLastVsLatest() { + redis.xadd("stream-1", Collections.singletonMap("key1", "value1")); + redis.xadd("stream-1", Collections.singletonMap("key2", "value2")); + + List> lastMessages = redis.xread(StreamOffset.last("stream-1")); + List> latestMessages = redis.xread(StreamOffset.latest("stream-1")); + + assertThat(lastMessages).hasSize(1); + StreamMessage lastMessage = lastMessages.get(0); + + assertThat(lastMessage.getStream()).isEqualTo("stream-1"); + assertThat(lastMessage.getBody()).hasSize(1).containsEntry("key2", "value2"); + + assertThat(latestMessages).isEmpty(); + } + @Test void xinfoStream() { From 7d5087e11ccac0e4624964e2b7b21fe7ad6ce835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Miguel=20Mej=C3=ADa=20Su=C3=A1rez?= Date: Fri, 31 May 2024 03:27:25 -0500 Subject: [PATCH 16/28] Add a `evalReadOnly` overload that accepts the script as a `String` (#2868) * Add a evalReadOnly overload that accepts the script as a String * Fix @since annotation for 7.0 --- .../core/AbstractRedisAsyncCommands.java | 6 ++++++ .../core/AbstractRedisReactiveCommands.java | 6 ++++++ .../async/RedisScriptingAsyncCommands.java | 13 +++++++++++++ .../RedisScriptingReactiveCommands.java | 13 +++++++++++++ .../core/api/sync/RedisScriptingCommands.java | 13 +++++++++++++ .../NodeSelectionScriptingAsyncCommands.java | 13 +++++++++++++ .../sync/NodeSelectionScriptingCommands.java | 13 +++++++++++++ .../RedisScriptingCoroutinesCommands.kt | 19 ++++++++++++++++++- .../RedisScriptingCoroutinesCommandsImpl.kt | 8 +++++++- .../core/api/RedisScriptingCommands.java | 13 +++++++++++++ .../ScriptingCommandIntegrationTests.java | 2 +- 11 files changed, 116 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java index 4749ad984f..b7da8fb2fd 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisAsyncCommands.java @@ -741,6 +741,12 @@ public RedisFuture eval(byte[] script, ScriptOutputType type, K[] keys, V return (RedisFuture) dispatch(commandBuilder.eval(script, type, keys, values)); } + @Override + @SuppressWarnings("unchecked") + public RedisFuture evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values) { + return evalReadOnly(encodeScript(script), type, keys, values); + } + @Override public RedisFuture evalReadOnly(byte[] script, ScriptOutputType type, K[] keys, V... values) { return (RedisFuture) dispatch(commandBuilder.eval(script, type, true, keys, values)); diff --git a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java index fa5630ed71..38404c1ea4 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/AbstractRedisReactiveCommands.java @@ -797,6 +797,12 @@ public Flux eval(byte[] script, ScriptOutputType type, K[] keys, V... val return createFlux(() -> commandBuilder.eval(script, type, keys, values)); } + @Override + @SuppressWarnings("unchecked") + public Flux evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values) { + return evalReadOnly(encodeScript(script), type, keys, values); + } + @Override public Flux evalReadOnly(byte[] script, ScriptOutputType type, K[] keys, V... values) { return createFlux(() -> commandBuilder.eval(script, type, true, keys, values)); diff --git a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java index 1367b489f2..0158e92f78 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java @@ -85,6 +85,19 @@ public interface RedisScriptingAsyncCommands { */ RedisFuture eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + RedisFuture evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java index 0272f0cda0..1d9d7917c6 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java @@ -84,6 +84,19 @@ public interface RedisScriptingReactiveCommands { */ Flux eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + Flux evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java index cc359cb42a..d6161251e5 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java @@ -84,6 +84,19 @@ public interface RedisScriptingCommands { */ T eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type output type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + T evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java index e116ce20b4..df0b551786 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java @@ -84,6 +84,19 @@ public interface NodeSelectionScriptingAsyncCommands { */ AsyncExecutions eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + AsyncExecutions evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java index e1c2306626..b7b40351b2 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java @@ -84,6 +84,19 @@ public interface NodeSelectionScriptingCommands { */ Executions eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + Executions evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommands.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommands.kt index 020ac1a873..711e7569b8 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommands.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommands.kt @@ -85,6 +85,24 @@ interface RedisScriptingCoroutinesCommands { */ suspend fun eval(script: ByteArray, type: ScriptOutputType, keys: Array, vararg values: V): T? + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + suspend fun evalReadOnly( + script: String, + type: ScriptOutputType, + keys: Array, + vararg values: V + ): T? + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * @@ -214,4 +232,3 @@ interface RedisScriptingCoroutinesCommands { suspend fun digest(script: ByteArray): String? } - diff --git a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommandsImpl.kt b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommandsImpl.kt index 403cb26164..30d0625b4e 100644 --- a/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommandsImpl.kt +++ b/src/main/kotlin/io/lettuce/core/api/coroutines/RedisScriptingCoroutinesCommandsImpl.kt @@ -51,6 +51,13 @@ internal class RedisScriptingCoroutinesCommandsImpl(internal v override suspend fun eval(script: ByteArray, type: ScriptOutputType, keys: Array, vararg values: V): T? = ops.eval(script, type, keys, *values).awaitFirstOrNull() + override suspend fun evalReadOnly( + script: String, + type: ScriptOutputType, + keys: Array, + vararg values: V + ): T? = ops.evalReadOnly(script, type, keys, *values).awaitFirstOrNull() + override suspend fun evalReadOnly( script: ByteArray, type: ScriptOutputType, @@ -86,4 +93,3 @@ internal class RedisScriptingCoroutinesCommandsImpl(internal v override suspend fun digest(script: ByteArray): String = ops.digest(script) } - diff --git a/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java b/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java index ed47b21ca7..96e09c3940 100644 --- a/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java @@ -83,6 +83,19 @@ public interface RedisScriptingCommands { */ T eval(byte[] script, ScriptOutputType type, K[] keys, V... values); + /** + * This is a read-only variant of the EVAL command that cannot execute commands that modify data. + * + * @param script Lua 5.1 script. + * @param type the type. + * @param keys the keys. + * @param values the values. + * @param expected return type. + * @return script result. + * @since 7.0 + */ + T evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); + /** * This is a read-only variant of the EVAL command that cannot execute commands that modify data. * diff --git a/src/test/java/io/lettuce/core/commands/ScriptingCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ScriptingCommandIntegrationTests.java index 96cd29db3f..1c7afd30e2 100644 --- a/src/test/java/io/lettuce/core/commands/ScriptingCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ScriptingCommandIntegrationTests.java @@ -134,7 +134,7 @@ void evalWithArgs() { @EnabledOnCommand("EVAL_RO") // Redis 7.0 void evalReadOnly() { String[] keys = new String[] { "key1" }; - assertThat((String) redis.evalReadOnly("return KEYS[1]".getBytes(), STATUS, keys, "a")).isEqualTo("key1"); + assertThat((String) redis.evalReadOnly("return KEYS[1]", STATUS, keys, "a")).isEqualTo("key1"); } @Test From 9832f90e332673f0d8d8613ef0e84fdd29358481 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Thu, 6 Jun 2024 19:43:02 +0300 Subject: [PATCH 17/28] Add release drafter workflow (#2820) * Release-drafter, dependabot, OCD polishing * Commitish not needed and pointing to the wrong branch anyway, also wrong version chosen * Pipeline is also very confusing as there are many pipelines, this is the INTEGRATION pipeline * Adding commitish, as it is required for filter-by-commitish * Autolabeling hits issues when using pull_request, using pull_request_target instead * pull_request_target does nothing, trying the other suggestion from https://github.com/release-drafter/release-drafter/issues/1125 --- .github/dependabot.yml | 9 ++++ .github/release-drafter-config.yml | 44 +++++++++++++++++++ .github/workflows/{codeql.yaml => codeql.yml} | 2 +- .../workflows/{cicd.yaml => integration.yml} | 2 +- .github/workflows/release-drafter.yml | 32 ++++++++++++++ .../{spellcheck.yaml => spellcheck.yml} | 2 +- 6 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter-config.yml rename .github/workflows/{codeql.yaml => codeql.yml} (97%) rename .github/workflows/{cicd.yaml => integration.yml} (97%) create mode 100644 .github/workflows/release-drafter.yml rename .github/workflows/{spellcheck.yaml => spellcheck.yml} (93%) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..e0aea65c23 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 + +updates: + - package-ecosystem: "maven" + directory: "/" + labels: + - "type: dependency-upgrade" + schedule: + interval: "weekly" diff --git a/.github/release-drafter-config.yml b/.github/release-drafter-config.yml new file mode 100644 index 0000000000..ee3ae3ad26 --- /dev/null +++ b/.github/release-drafter-config.yml @@ -0,0 +1,44 @@ +name-template: '$NEXT_PATCH_VERSION' +tag-template: 'v$NEXT_PATCH_VERSION' +filter-by-commitish: true +commitish: main + +autolabeler: + - label: 'type: documentation' + files: + - '*.md' + - '.github/*' + - label: 'type: task' + files: + - '.github/*' + - label: 'type: dependency-upgrade' + files: + - 'pom.xml' + +categories: + - title: '🔥 Breaking Changes' + labels: + - 'breakingchange' + - 'type: breaking' + - title: '🚀 New Features' + labels: + - 'type: enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'type: bug' + - title: '🧰 Maintenance' + labels: + - 'type: documentation' + - 'type: dependency-upgrade' + - 'type: task' + +change-template: '- $TITLE (#$NUMBER)' +exclude-labels: + - 'skip-changelog' + +template: | + # Changes + $CHANGES + ## Contributors + We'd like to thank all the contributors who worked on this release! + $CONTRIBUTORS diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yml similarity index 97% rename from .github/workflows/codeql.yaml rename to .github/workflows/codeql.yml index 27aa7f3e4c..fa90a8e24d 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,4 @@ -name: "CodeQL analysis" +name: CodeQL analysis on: push: diff --git a/.github/workflows/cicd.yaml b/.github/workflows/integration.yml similarity index 97% rename from .github/workflows/cicd.yaml rename to .github/workflows/integration.yml index 692738de40..938cc30f48 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/integration.yml @@ -1,4 +1,4 @@ -name: CI / CD Pipeline +name: Continuous Integration on: push: paths-ignore: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000000..8461e501fe --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,32 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - '[0-9].*' + # pull_request event is required only for autolabeler + pull_request: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + with: + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + config-name: release-drafter-config.yml + commitish: main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yml similarity index 93% rename from .github/workflows/spellcheck.yaml rename to .github/workflows/spellcheck.yml index 943d54098b..f3239f240b 100644 --- a/.github/workflows/spellcheck.yaml +++ b/.github/workflows/spellcheck.yml @@ -1,4 +1,4 @@ -name: Spellcheck Action +name: Spellcheck on: pull_request: jobs: From 3c4401241c588581f477e69f9f49cf772228dfc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:17:40 +0300 Subject: [PATCH 18/28] Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.3 to 3.7.0 (#2873) Bumps [org.apache.maven.plugins:maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.6.3 to 3.7.0. - [Release notes](https://github.com/apache/maven-javadoc-plugin/releases) - [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.6.3...maven-javadoc-plugin-3.7.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-javadoc-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 20c34575a3..11ce747f22 100644 --- a/pom.xml +++ b/pom.xml @@ -595,7 +595,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.6.3 + 3.7.0 From 1c272ec0245482153917e344b323f7c6da152d50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:17:59 +0300 Subject: [PATCH 19/28] Bump org.codehaus.mojo:flatten-maven-plugin from 1.5.0 to 1.6.0 (#2874) Bumps [org.codehaus.mojo:flatten-maven-plugin](https://github.com/mojohaus/flatten-maven-plugin) from 1.5.0 to 1.6.0. - [Release notes](https://github.com/mojohaus/flatten-maven-plugin/releases) - [Commits](https://github.com/mojohaus/flatten-maven-plugin/compare/1.5.0...1.6.0) --- updated-dependencies: - dependency-name: org.codehaus.mojo:flatten-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 11ce747f22..cb90383a8e 100644 --- a/pom.xml +++ b/pom.xml @@ -547,7 +547,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.5.0 + 1.6.0 From eb07932099bacf885bb5cd0a2927e79ccfe12aa5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:23:59 +0300 Subject: [PATCH 20/28] Bump org.apache.maven.plugins:maven-jar-plugin from 3.3.0 to 3.4.1 (#2875) Bumps [org.apache.maven.plugins:maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.3.0 to 3.4.1. - [Release notes](https://github.com/apache/maven-jar-plugin/releases) - [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.3.0...maven-jar-plugin-3.4.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-jar-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cb90383a8e..54bf15da25 100644 --- a/pom.xml +++ b/pom.xml @@ -583,7 +583,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.3.0 + 3.4.1 From a5e535ce0f7955f90fba9801e5cfcf79459adcaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:32:40 +0300 Subject: [PATCH 21/28] Bump org.openjdk.jmh:jmh-generator-annprocess from 1.21 to 1.37 (#2876) Bumps [org.openjdk.jmh:jmh-generator-annprocess](https://github.com/openjdk/jmh) from 1.21 to 1.37. - [Commits](https://github.com/openjdk/jmh/compare/1.21...1.37) --- updated-dependencies: - dependency-name: org.openjdk.jmh:jmh-generator-annprocess dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 54bf15da25..24a562d953 100644 --- a/pom.xml +++ b/pom.xml @@ -1109,7 +1109,7 @@ org.openjdk.jmh jmh-generator-annprocess - 1.21 + 1.37 test From d3b62140e160494681ca5fda187bf52ec2492138 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:48:30 +0300 Subject: [PATCH 22/28] Bump org.apache.commons:commons-pool2 from 2.11.1 to 2.12.0 (#2877) Bumps org.apache.commons:commons-pool2 from 2.11.1 to 2.12.0. --- updated-dependencies: - dependency-name: org.apache.commons:commons-pool2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 24a562d953..e3a401e050 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 2.0.SP1 5.13.11 3.13.0 - 2.11.1 + 2.12.0 1.3.2 4.0.1 5.10.2 From 544ec67c2077959395a9e566a5b4d465fb694c5a Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Fri, 7 Jun 2024 14:55:04 +0300 Subject: [PATCH 23/28] Setting the next release to be 6.4.x as part of #2880 (#2881) * Bump version of lettuce-core to 6.4.0 * Change all @since notations to match the next release 6.4.x and also fixed two typos in the API JavaDoc * Fixed formatting issues --- pom.xml | 2 +- src/main/java/io/lettuce/core/KillArgs.java | 4 +- .../java/io/lettuce/core/ScanIterator.java | 4 +- src/main/java/io/lettuce/core/ScanStream.java | 4 +- src/main/java/io/lettuce/core/XReadArgs.java | 2 +- .../api/async/BaseRedisAsyncCommands.java | 4 +- .../api/async/RedisHashAsyncCommands.java | 156 +++++++++--------- .../core/api/async/RedisKeyAsyncCommands.java | 20 +-- .../async/RedisScriptingAsyncCommands.java | 2 +- .../reactive/BaseRedisReactiveCommands.java | 4 +- .../reactive/RedisHashReactiveCommands.java | 148 ++++++++--------- .../reactive/RedisKeyReactiveCommands.java | 20 +-- .../RedisScriptingReactiveCommands.java | 2 +- .../core/api/sync/BaseRedisCommands.java | 4 +- .../core/api/sync/RedisHashCommands.java | 156 +++++++++--------- .../core/api/sync/RedisKeyCommands.java | 20 +-- .../core/api/sync/RedisScriptingCommands.java | 2 +- .../async/BaseNodeSelectionAsyncCommands.java | 4 +- .../async/NodeSelectionHashAsyncCommands.java | 156 +++++++++--------- .../async/NodeSelectionKeyAsyncCommands.java | 20 +-- .../NodeSelectionScriptingAsyncCommands.java | 2 +- .../api/sync/BaseNodeSelectionCommands.java | 4 +- .../api/sync/NodeSelectionHashCommands.java | 156 +++++++++--------- .../api/sync/NodeSelectionKeyCommands.java | 20 +-- .../sync/NodeSelectionScriptingCommands.java | 2 +- .../pubsub/RedisClusterPubSubListener.java | 6 +- .../NodeSelectionPubSubAsyncCommands.java | 4 +- .../NodeSelectionPubSubReactiveCommands.java | 4 +- .../api/sync/NodeSelectionPubSubCommands.java | 4 +- .../core/pubsub/RedisPubSubListener.java | 6 +- .../api/async/RedisPubSubAsyncCommands.java | 4 +- .../reactive/RedisPubSubReactiveCommands.java | 4 +- .../pubsub/api/sync/RedisPubSubCommands.java | 4 +- .../lettuce/core/api/BaseRedisCommands.java | 4 +- .../lettuce/core/api/RedisHashCommands.java | 156 +++++++++--------- .../io/lettuce/core/api/RedisKeyCommands.java | 20 +-- .../core/api/RedisScriptingCommands.java | 2 +- 37 files changed, 568 insertions(+), 568 deletions(-) diff --git a/pom.xml b/pom.xml index e3a401e050..9be9d982f7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.lettuce lettuce-core - 7.0.0.BUILD-SNAPSHOT + 6.4.0.BUILD-SNAPSHOT jar Lettuce diff --git a/src/main/java/io/lettuce/core/KillArgs.java b/src/main/java/io/lettuce/core/KillArgs.java index d24325c504..9a8ed21acd 100644 --- a/src/main/java/io/lettuce/core/KillArgs.java +++ b/src/main/java/io/lettuce/core/KillArgs.java @@ -167,7 +167,7 @@ public static KillArgs user(String username) { * * @return new {@link KillArgs} with {@literal MAXAGE} set. * @see KillArgs#maxAge(Long) - * @since 7.0 + * @since 6.4 */ public static KillArgs maxAge(Long maxAge) { return new KillArgs().maxAge(maxAge); @@ -259,7 +259,7 @@ public KillArgs type(Type type) { * * @param maxAge must not be {@code null}. * @return {@code this} {@link KillArgs}. - * @since 7.0 + * @since 6.4 */ public KillArgs maxAge(Long maxAge) { diff --git a/src/main/java/io/lettuce/core/ScanIterator.java b/src/main/java/io/lettuce/core/ScanIterator.java index 011eb02dc7..d3b617d240 100644 --- a/src/main/java/io/lettuce/core/ScanIterator.java +++ b/src/main/java/io/lettuce/core/ScanIterator.java @@ -113,7 +113,7 @@ public static ScanIterator> hscan(RedisHashCommands * @param Key type. * @param Value type. * @return a new {@link ScanIterator}. - * @since 7.0 + * @since 6.4 */ public static ScanIterator hscanNovalues(RedisHashCommands commands, K key) { return hscanNovalues(commands, key, Optional.empty()); @@ -147,7 +147,7 @@ public static ScanIterator> hscan(RedisHashCommands * @param Key type. * @param Value type. * @return a new {@link ScanIterator}. - * @since 7.0 + * @since 6.4 */ public static ScanIterator hscanNovalues(RedisHashCommands commands, K key, ScanArgs scanArgs) { diff --git a/src/main/java/io/lettuce/core/ScanStream.java b/src/main/java/io/lettuce/core/ScanStream.java index 560c22a4a0..0b2828c0f5 100644 --- a/src/main/java/io/lettuce/core/ScanStream.java +++ b/src/main/java/io/lettuce/core/ScanStream.java @@ -114,7 +114,7 @@ public static Flux> hscan(RedisHashReactiveCommands * @param Key type. * @param Value type. * @return a new {@link Flux}. - * @since 7.0 + * @since 6.4 */ public static Flux hscanNovalues(RedisHashReactiveCommands commands, K key) { return hscanNovalues(commands, key, Optional.empty()); @@ -148,7 +148,7 @@ public static Flux> hscan(RedisHashReactiveCommands * @param Key type. * @param Value type. * @return a new {@link Flux}. - * @since 7.0 + * @since 6.4 */ public static Flux hscanNovalues(RedisHashReactiveCommands commands, K key, ScanArgs scanArgs) { diff --git a/src/main/java/io/lettuce/core/XReadArgs.java b/src/main/java/io/lettuce/core/XReadArgs.java index c08338e2dd..b6fa3ead93 100644 --- a/src/main/java/io/lettuce/core/XReadArgs.java +++ b/src/main/java/io/lettuce/core/XReadArgs.java @@ -189,7 +189,7 @@ public static StreamOffset latest(K name) { * * @param name must not be {@code null}. * @return the {@link StreamOffset} object without a specific offset. - * @since 7.0 + * @since 6.4 */ public static StreamOffset last(K name) { diff --git a/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java index 76aac4f8ea..444513ee0c 100644 --- a/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java @@ -91,7 +91,7 @@ public interface BaseRedisAsyncCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ RedisFuture> pubsubShardNumsub(K... shardChannels); @@ -108,7 +108,7 @@ public interface BaseRedisAsyncCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ RedisFuture spublish(K shardChannel, V message); diff --git a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java index 209d6c469f..ee0b8eed1a 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisHashAsyncCommands.java @@ -224,7 +224,7 @@ public interface RedisHashAsyncCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture> hscanNovalues(K key); @@ -243,7 +243,7 @@ public interface RedisHashAsyncCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture> hscanNovalues(K key, ScanArgs scanArgs); @@ -264,7 +264,7 @@ public interface RedisHashAsyncCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture> hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -283,7 +283,7 @@ public interface RedisHashAsyncCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture> hscanNovalues(K key, ScanCursor scanCursor); @@ -302,7 +302,7 @@ public interface RedisHashAsyncCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture hscanNovalues(KeyStreamingChannel channel, K key); @@ -323,7 +323,7 @@ public interface RedisHashAsyncCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -347,7 +347,7 @@ RedisFuture hscan(KeyValueStreamingChannel channel, K ke * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -369,7 +369,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ RedisFuture hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -443,10 +443,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hexpire(K key, long seconds, K... fields); @@ -455,13 +455,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -472,10 +472,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hexpire(K key, Duration seconds, K... fields); @@ -487,10 +487,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -501,10 +501,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, long timestamp, K... fields); @@ -513,13 +513,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -530,10 +530,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, Date timestamp, K... fields); @@ -542,13 +542,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -559,10 +559,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, Instant timestamp, K... fields); @@ -571,13 +571,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -588,7 +588,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hexpiretime(K key, K... fields); @@ -599,7 +599,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpersist(K key, K... fields); @@ -610,10 +610,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hpexpire(K key, long milliseconds, K... fields); @@ -622,13 +622,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -639,10 +639,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hpexpire(K key, Duration milliseconds, K... fields); @@ -651,13 +651,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ RedisFuture> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -668,10 +668,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, long timestamp, K... fields); @@ -680,13 +680,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -697,10 +697,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, Date timestamp, K... fields); @@ -709,13 +709,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -726,10 +726,10 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, Instant timestamp, K... fields); @@ -738,13 +738,13 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -756,7 +756,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ RedisFuture> hpexpiretime(K key, K... fields); @@ -768,7 +768,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ RedisFuture> httl(K key, K... fields); @@ -780,7 +780,7 @@ RedisFuture hscanNovalues(KeyStreamingChannel channel, K ke * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ RedisFuture> hpttl(K key, K... fields); diff --git a/src/main/java/io/lettuce/core/api/async/RedisKeyAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisKeyAsyncCommands.java index cceffb8a71..078a4a57a7 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisKeyAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisKeyAsyncCommands.java @@ -107,7 +107,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -130,7 +130,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -152,7 +152,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -174,7 +174,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -197,7 +197,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -324,7 +324,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -347,7 +347,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -369,7 +369,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -391,7 +391,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -413,7 +413,7 @@ public interface RedisKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java index 0158e92f78..2c56fa2cc7 100644 --- a/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/api/async/RedisScriptingAsyncCommands.java @@ -94,7 +94,7 @@ public interface RedisScriptingAsyncCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ RedisFuture evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); diff --git a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java index 43fd4ec538..b0d089b237 100644 --- a/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/BaseRedisReactiveCommands.java @@ -91,7 +91,7 @@ public interface BaseRedisReactiveCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ Mono> pubsubShardNumsub(K... shardChannels); @@ -108,7 +108,7 @@ public interface BaseRedisReactiveCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ Mono spublish(K shardChannel, V message); diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java index 6530b775b2..c0bc9f073d 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisHashReactiveCommands.java @@ -233,7 +233,7 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Mono> hscanNovalues(K key); @@ -252,7 +252,7 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Mono> hscanNovalues(K key, ScanArgs scanArgs); @@ -273,7 +273,7 @@ public interface RedisHashReactiveCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Mono> hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -292,7 +292,7 @@ public interface RedisHashReactiveCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Mono> hscanNovalues(K key, ScanCursor scanCursor); @@ -473,10 +473,10 @@ public interface RedisHashReactiveCommands { * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hexpire(K key, long seconds, K... fields); @@ -485,13 +485,13 @@ public interface RedisHashReactiveCommands { * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -502,10 +502,10 @@ public interface RedisHashReactiveCommands { * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hexpire(K key, Duration seconds, K... fields); @@ -517,10 +517,10 @@ public interface RedisHashReactiveCommands { * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -531,10 +531,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, long timestamp, K... fields); @@ -543,13 +543,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -560,10 +560,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, Date timestamp, K... fields); @@ -572,13 +572,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -589,10 +589,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, Instant timestamp, K... fields); @@ -601,13 +601,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -618,7 +618,7 @@ public interface RedisHashReactiveCommands { * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hexpiretime(K key, K... fields); @@ -629,7 +629,7 @@ public interface RedisHashReactiveCommands { * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpersist(K key, K... fields); @@ -640,10 +640,10 @@ public interface RedisHashReactiveCommands { * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hpexpire(K key, long milliseconds, K... fields); @@ -652,13 +652,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -669,10 +669,10 @@ public interface RedisHashReactiveCommands { * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hpexpire(K key, Duration milliseconds, K... fields); @@ -681,13 +681,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Flux hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -698,10 +698,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, long timestamp, K... fields); @@ -710,13 +710,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -727,10 +727,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, Date timestamp, K... fields); @@ -739,13 +739,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -756,10 +756,10 @@ public interface RedisHashReactiveCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, Instant timestamp, K... fields); @@ -768,13 +768,13 @@ public interface RedisHashReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Flux hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -786,7 +786,7 @@ public interface RedisHashReactiveCommands { * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ Flux hpexpiretime(K key, K... fields); @@ -798,7 +798,7 @@ public interface RedisHashReactiveCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ Flux httl(K key, K... fields); @@ -810,7 +810,7 @@ public interface RedisHashReactiveCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ Flux hpttl(K key, K... fields); diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisKeyReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisKeyReactiveCommands.java index 1fbfdda1a8..e08654af88 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisKeyReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisKeyReactiveCommands.java @@ -117,7 +117,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -140,7 +140,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -162,7 +162,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -184,7 +184,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -207,7 +207,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -337,7 +337,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -360,7 +360,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -382,7 +382,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -404,7 +404,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -426,7 +426,7 @@ public interface RedisKeyReactiveCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java index 1d9d7917c6..30164f566c 100644 --- a/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java +++ b/src/main/java/io/lettuce/core/api/reactive/RedisScriptingReactiveCommands.java @@ -93,7 +93,7 @@ public interface RedisScriptingReactiveCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ Flux evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); diff --git a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java index 8082e84521..303469cbb9 100644 --- a/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/BaseRedisCommands.java @@ -90,7 +90,7 @@ public interface BaseRedisCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ Map pubsubShardNumsub(K... shardChannels); @@ -107,7 +107,7 @@ public interface BaseRedisCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ Long spublish(K shardChannel, V message); diff --git a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java index 6345f8593f..2d9f3ac313 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisHashCommands.java @@ -223,7 +223,7 @@ public interface RedisHashCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key); @@ -242,7 +242,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanArgs scanArgs); @@ -263,7 +263,7 @@ public interface RedisHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -282,7 +282,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanCursor scanCursor); @@ -301,7 +301,7 @@ public interface RedisHashCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key); @@ -322,7 +322,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -345,7 +345,7 @@ public interface RedisHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -366,7 +366,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -440,10 +440,10 @@ public interface RedisHashCommands { * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, long seconds, K... fields); @@ -452,13 +452,13 @@ public interface RedisHashCommands { * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -469,10 +469,10 @@ public interface RedisHashCommands { * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, Duration seconds, K... fields); @@ -484,10 +484,10 @@ public interface RedisHashCommands { * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -498,10 +498,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, long timestamp, K... fields); @@ -510,13 +510,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -527,10 +527,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Date timestamp, K... fields); @@ -539,13 +539,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -556,10 +556,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Instant timestamp, K... fields); @@ -568,13 +568,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -585,7 +585,7 @@ public interface RedisHashCommands { * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpiretime(K key, K... fields); @@ -596,7 +596,7 @@ public interface RedisHashCommands { * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpersist(K key, K... fields); @@ -607,10 +607,10 @@ public interface RedisHashCommands { * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, long milliseconds, K... fields); @@ -619,13 +619,13 @@ public interface RedisHashCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -636,10 +636,10 @@ public interface RedisHashCommands { * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, Duration milliseconds, K... fields); @@ -648,13 +648,13 @@ public interface RedisHashCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -665,10 +665,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, long timestamp, K... fields); @@ -677,13 +677,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -694,10 +694,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Date timestamp, K... fields); @@ -706,13 +706,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -723,10 +723,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Instant timestamp, K... fields); @@ -735,13 +735,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -753,7 +753,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ List hpexpiretime(K key, K... fields); @@ -765,7 +765,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ List httl(K key, K... fields); @@ -777,7 +777,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ List hpttl(K key, K... fields); diff --git a/src/main/java/io/lettuce/core/api/sync/RedisKeyCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisKeyCommands.java index 516e4ab072..c806730e75 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisKeyCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisKeyCommands.java @@ -116,7 +116,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -139,7 +139,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -161,7 +161,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -183,7 +183,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -206,7 +206,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -333,7 +333,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -356,7 +356,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -378,7 +378,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -400,7 +400,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -422,7 +422,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java index d6161251e5..48da2c9c81 100644 --- a/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java +++ b/src/main/java/io/lettuce/core/api/sync/RedisScriptingCommands.java @@ -93,7 +93,7 @@ public interface RedisScriptingCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ T evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); diff --git a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java index 795a3f0848..ac58de80af 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/BaseNodeSelectionAsyncCommands.java @@ -91,7 +91,7 @@ public interface BaseNodeSelectionAsyncCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> pubsubShardNumsub(K... shardChannels); @@ -108,7 +108,7 @@ public interface BaseNodeSelectionAsyncCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ AsyncExecutions spublish(K shardChannel, V message); diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java index 3dbf6b2af6..f6e733034f 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionHashAsyncCommands.java @@ -223,7 +223,7 @@ public interface NodeSelectionHashAsyncCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hscanNovalues(K key); @@ -242,7 +242,7 @@ public interface NodeSelectionHashAsyncCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hscanNovalues(K key, ScanArgs scanArgs); @@ -263,7 +263,7 @@ public interface NodeSelectionHashAsyncCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -282,7 +282,7 @@ public interface NodeSelectionHashAsyncCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hscanNovalues(K key, ScanCursor scanCursor); @@ -301,7 +301,7 @@ public interface NodeSelectionHashAsyncCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key); @@ -322,7 +322,7 @@ public interface NodeSelectionHashAsyncCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -346,7 +346,7 @@ AsyncExecutions hscan(KeyValueStreamingChannel channel, * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -368,7 +368,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -442,10 +442,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hexpire(K key, long seconds, K... fields); @@ -454,13 +454,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -471,10 +471,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hexpire(K key, Duration seconds, K... fields); @@ -486,10 +486,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -500,10 +500,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, long timestamp, K... fields); @@ -512,13 +512,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -529,10 +529,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, Date timestamp, K... fields); @@ -541,13 +541,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -558,10 +558,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, Instant timestamp, K... fields); @@ -570,13 +570,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -587,7 +587,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hexpiretime(K key, K... fields); @@ -598,7 +598,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpersist(K key, K... fields); @@ -609,10 +609,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hpexpire(K key, long milliseconds, K... fields); @@ -621,13 +621,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -638,10 +638,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hpexpire(K key, Duration milliseconds, K... fields); @@ -650,13 +650,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ AsyncExecutions> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -667,10 +667,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, long timestamp, K... fields); @@ -679,13 +679,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -696,10 +696,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, Date timestamp, K... fields); @@ -708,13 +708,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -725,10 +725,10 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, Instant timestamp, K... fields); @@ -737,13 +737,13 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -755,7 +755,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpexpiretime(K key, K... fields); @@ -767,7 +767,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> httl(K key, K... fields); @@ -779,7 +779,7 @@ AsyncExecutions hscanNovalues(KeyStreamingChannel channel, * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ AsyncExecutions> hpttl(K key, K... fields); diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionKeyAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionKeyAsyncCommands.java index 44bbd168a3..29cf0464b1 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionKeyAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionKeyAsyncCommands.java @@ -116,7 +116,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -139,7 +139,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -161,7 +161,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -183,7 +183,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -206,7 +206,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -333,7 +333,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -356,7 +356,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -378,7 +378,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -400,7 +400,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -422,7 +422,7 @@ public interface NodeSelectionKeyAsyncCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java index df0b551786..bf3daca58f 100644 --- a/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/async/NodeSelectionScriptingAsyncCommands.java @@ -93,7 +93,7 @@ public interface NodeSelectionScriptingAsyncCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ AsyncExecutions evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java index d82031aa5d..9b7978f499 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/BaseNodeSelectionCommands.java @@ -86,7 +86,7 @@ public interface BaseNodeSelectionCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ Executions> pubsubShardNumsub(K... shardChannels); @@ -103,7 +103,7 @@ public interface BaseNodeSelectionCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ Executions spublish(K shardChannel, V message); diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java index ee344d1180..05cf792d92 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionHashCommands.java @@ -223,7 +223,7 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Executions> hscanNovalues(K key); @@ -242,7 +242,7 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Executions> hscanNovalues(K key, ScanArgs scanArgs); @@ -263,7 +263,7 @@ public interface NodeSelectionHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Executions> hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -282,7 +282,7 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ Executions> hscanNovalues(K key, ScanCursor scanCursor); @@ -301,7 +301,7 @@ public interface NodeSelectionHashCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ Executions hscanNovalues(KeyStreamingChannel channel, K key); @@ -322,7 +322,7 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ Executions hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -345,7 +345,7 @@ public interface NodeSelectionHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ Executions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -366,7 +366,7 @@ public interface NodeSelectionHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ Executions hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -440,10 +440,10 @@ public interface NodeSelectionHashCommands { * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hexpire(K key, long seconds, K... fields); @@ -452,13 +452,13 @@ public interface NodeSelectionHashCommands { * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -469,10 +469,10 @@ public interface NodeSelectionHashCommands { * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hexpire(K key, Duration seconds, K... fields); @@ -484,10 +484,10 @@ public interface NodeSelectionHashCommands { * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -498,10 +498,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, long timestamp, K... fields); @@ -510,13 +510,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -527,10 +527,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, Date timestamp, K... fields); @@ -539,13 +539,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -556,10 +556,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, Instant timestamp, K... fields); @@ -568,13 +568,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -585,7 +585,7 @@ public interface NodeSelectionHashCommands { * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hexpiretime(K key, K... fields); @@ -596,7 +596,7 @@ public interface NodeSelectionHashCommands { * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpersist(K key, K... fields); @@ -607,10 +607,10 @@ public interface NodeSelectionHashCommands { * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hpexpire(K key, long milliseconds, K... fields); @@ -619,13 +619,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -636,10 +636,10 @@ public interface NodeSelectionHashCommands { * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hpexpire(K key, Duration milliseconds, K... fields); @@ -648,13 +648,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ Executions> hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -665,10 +665,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, long timestamp, K... fields); @@ -677,13 +677,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -694,10 +694,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, Date timestamp, K... fields); @@ -706,13 +706,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -723,10 +723,10 @@ public interface NodeSelectionHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, Instant timestamp, K... fields); @@ -735,13 +735,13 @@ public interface NodeSelectionHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ Executions> hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -753,7 +753,7 @@ public interface NodeSelectionHashCommands { * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ Executions> hpexpiretime(K key, K... fields); @@ -765,7 +765,7 @@ public interface NodeSelectionHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ Executions> httl(K key, K... fields); @@ -777,7 +777,7 @@ public interface NodeSelectionHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ Executions> hpttl(K key, K... fields); diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionKeyCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionKeyCommands.java index d09dd4f39a..22cb374a78 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionKeyCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionKeyCommands.java @@ -116,7 +116,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -139,7 +139,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -161,7 +161,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -183,7 +183,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -206,7 +206,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -333,7 +333,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -356,7 +356,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -378,7 +378,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -400,7 +400,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -422,7 +422,7 @@ public interface NodeSelectionKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java index b7b40351b2..9a921d18d0 100644 --- a/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java +++ b/src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionScriptingCommands.java @@ -93,7 +93,7 @@ public interface NodeSelectionScriptingCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ Executions evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java index b1755f80b9..b2ec3cc5ff 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/RedisClusterPubSubListener.java @@ -73,7 +73,7 @@ public interface RedisClusterPubSubListener { * @param node the {@link RedisClusterNode} from which the {@code message} originates. * @param shardChannel shard channel. * @param message Message. - * @since 7.0 + * @since 6.4 */ default void smessage(RedisClusterNode node, K shardChannel, V message) { message(node, shardChannel, message); @@ -85,7 +85,7 @@ default void smessage(RedisClusterNode node, K shardChannel, V message) { * @param node the {@link RedisClusterNode} from which the {@code message} originates. * @param shardChannel Shard channel * @param count Subscription count. - * @since 7.0 + * @since 6.4 */ default void ssubscribed(RedisClusterNode node, K shardChannel, long count) { subscribed(node, shardChannel, count); @@ -97,7 +97,7 @@ default void ssubscribed(RedisClusterNode node, K shardChannel, long count) { * @param node the {@link RedisClusterNode} from which the {@code message} originates. * @param shardChannel Shard channel * @param count Subscription count. - * @since 7.0 + * @since 6.4 */ default void sunsubscribed(RedisClusterNode node, K shardChannel, long count) { unsubscribed(node, shardChannel, count); diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java index 19f1980e01..9da3ce0b99 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/async/NodeSelectionPubSubAsyncCommands.java @@ -47,7 +47,7 @@ public interface NodeSelectionPubSubAsyncCommands { * * @param shardChannels the channels * @return RedisFuture<Void> Future to synchronize {@code subscribe} completion - * @since 7.0 + * @since 6.4 */ AsyncExecutions ssubscribe(K... shardChannels); @@ -56,7 +56,7 @@ public interface NodeSelectionPubSubAsyncCommands { * * @param shardChannels the channels * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. - * @since 7.0 + * @since 6.4 */ AsyncExecutions sunsubscribe(K... shardChannels); diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java index 3da91dddd1..fd0582f409 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/reactive/NodeSelectionPubSubReactiveCommands.java @@ -47,7 +47,7 @@ public interface NodeSelectionPubSubReactiveCommands { * * @param shardCchannels the channels * @return RedisFuture<Void> Future to synchronize {@code subscribe} completion - * @since 7.0 + * @since 6.4 */ ReactiveExecutions ssubscribe(K... shardCchannels); @@ -56,7 +56,7 @@ public interface NodeSelectionPubSubReactiveCommands { * * @param shardCchannels the channels * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. - * @since 7.0 + * @since 6.4 */ ReactiveExecutions sunsubscribe(K... shardCchannels); diff --git a/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java b/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java index 6a3716c9fc..ee107c24a5 100644 --- a/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java +++ b/src/main/java/io/lettuce/core/cluster/pubsub/api/sync/NodeSelectionPubSubCommands.java @@ -47,7 +47,7 @@ public interface NodeSelectionPubSubCommands { * * @param shardChannels the channels * @return Executions Future to synchronize {@code subscribe} completion - * @since 7.0 + * @since 6.4 */ Executions ssubscribe(K... shardChannels); @@ -56,7 +56,7 @@ public interface NodeSelectionPubSubCommands { * * @param shardChannels the channels * @return Executions Future to synchronize {@code unsubscribe} completion. - * @since 7.0 + * @since 6.4 */ Executions sunsubscribe(K... shardChannels); diff --git a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java index ae0aff2e4a..ef8c2ba6a2 100644 --- a/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java +++ b/src/main/java/io/lettuce/core/pubsub/RedisPubSubListener.java @@ -82,7 +82,7 @@ public interface RedisPubSubListener { * * @param shardChannel Shard channel * @param count Subscription count. - * @since 7.0 + * @since 6.4 */ default void ssubscribed(K shardChannel, long count) { subscribed(shardChannel, count); @@ -93,7 +93,7 @@ default void ssubscribed(K shardChannel, long count) { * * @param shardChannel Channel * @param count Subscription count. - * @since 7.0 + * @since 6.4 */ default void sunsubscribed(K shardChannel, long count) { unsubscribed(shardChannel, count); @@ -104,7 +104,7 @@ default void sunsubscribed(K shardChannel, long count) { * * @param shardChannel shard channel. * @param message Message. - * @since 7.0 + * @since 6.4 */ default void smessage(K shardChannel, V message) { message(shardChannel, message); diff --git a/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java b/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java index 8750588552..5e680e7f61 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/async/RedisPubSubAsyncCommands.java @@ -56,7 +56,7 @@ public interface RedisPubSubAsyncCommands extends RedisAsyncCommands * * @param shardChannels the shard channels * @return RedisFuture<Void> Future to synchronize {@code subscribe} completion - * @since 7.0 + * @since 6.4 */ RedisFuture ssubscribe(K... shardChannels); @@ -65,7 +65,7 @@ public interface RedisPubSubAsyncCommands extends RedisAsyncCommands * * @param shardChannels the shard channels * @return RedisFuture<Void> Future to synchronize {@code unsubscribe} completion. - * @since 7.0 + * @since 6.4 */ RedisFuture sunsubscribe(K... shardChannels); diff --git a/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java b/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java index 6f1f0e0817..6bcf7848a2 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/reactive/RedisPubSubReactiveCommands.java @@ -103,7 +103,7 @@ public interface RedisPubSubReactiveCommands extends RedisReactiveCommands * * @param shardChannels the channels. * @return Mono<Void> Mono for {@code subscribe} command. - * @since 7.0 + * @since 6.4 */ Mono ssubscribe(K... shardChannels); @@ -113,7 +113,7 @@ public interface RedisPubSubReactiveCommands extends RedisReactiveCommands * * @param shardChannels the channels. * @return Mono<Void> Mono for {@code unsubscribe} command. - * @since 7.0 + * @since 6.4 */ Mono sunsubscribe(K... shardChannels); diff --git a/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java b/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java index b3ea69fb62..d7d186280e 100644 --- a/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java +++ b/src/main/java/io/lettuce/core/pubsub/api/sync/RedisPubSubCommands.java @@ -45,7 +45,7 @@ public interface RedisPubSubCommands extends RedisCommands { * Listen for messages published to the given shard channels. * * @param shardChannels the channels - * @since 7.0 + * @since 6.4 */ void ssubscribe(K... shardChannels); @@ -53,7 +53,7 @@ public interface RedisPubSubCommands extends RedisCommands { * Stop listening for messages posted to the given channels. * * @param shardChannels the channels - * @since 7.0 + * @since 6.4 */ void sunsubscribe(K... shardChannels); diff --git a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java index 3fa6f26e4a..744f9ea47c 100644 --- a/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java +++ b/src/main/templates/io/lettuce/core/api/BaseRedisCommands.java @@ -91,7 +91,7 @@ public interface BaseRedisCommands { * * @param shardChannels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. - * @since 7.0 + * @since 6.4 */ Map pubsubShardNumsub(K... shardChannels); @@ -108,7 +108,7 @@ public interface BaseRedisCommands { * @param shardChannel the shard channel type: key. * @param message the message type: value. * @return Long integer-reply the number of clients that received the message. - * @since 7.0 + * @since 6.4 */ Long spublish(K shardChannel, V message); diff --git a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java index 4d44cc2979..ac05591741 100644 --- a/src/main/templates/io/lettuce/core/api/RedisHashCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisHashCommands.java @@ -218,7 +218,7 @@ public interface RedisHashCommands { * * @param key the key. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key); @@ -237,7 +237,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanArgs scanArgs); @@ -258,7 +258,7 @@ public interface RedisHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -277,7 +277,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return KeyScanCursor<K> key scan cursor. - * @since 7.0 + * @since 6.4 */ KeyScanCursor hscanNovalues(K key, ScanCursor scanCursor); @@ -296,7 +296,7 @@ public interface RedisHashCommands { * @param channel streaming channel that receives a call for every key. * @param key the key. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key); @@ -317,7 +317,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanArgs scanArgs); @@ -340,7 +340,7 @@ public interface RedisHashCommands { * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @param scanArgs scan arguments. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor, ScanArgs scanArgs); @@ -361,7 +361,7 @@ public interface RedisHashCommands { * @param key the key. * @param scanCursor cursor to resume from a previous scan, must not be {@code null}. * @return StreamScanCursor scan cursor. - * @since 7.0 + * @since 6.4 */ StreamScanCursor hscanNovalues(KeyStreamingChannel channel, K key, ScanCursor scanCursor); @@ -435,10 +435,10 @@ public interface RedisHashCommands { * @param seconds the seconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, long seconds, K... fields); @@ -447,13 +447,13 @@ public interface RedisHashCommands { * * @param key the key of the fields. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, long seconds, ExpireArgs expireArgs, K... fields); @@ -464,10 +464,10 @@ public interface RedisHashCommands { * @param seconds the TTL {@link Duration} * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, Duration seconds, K... fields); @@ -479,10 +479,10 @@ public interface RedisHashCommands { * @param expireArgs the {@link ExpireArgs}. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hexpire(K key, Duration seconds, ExpireArgs expireArgs, K... fields); @@ -493,10 +493,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, long timestamp, K... fields); @@ -505,13 +505,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -522,10 +522,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Date timestamp, K... fields); @@ -534,13 +534,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -551,10 +551,10 @@ public interface RedisHashCommands { * @param timestamp the timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Instant timestamp, K... fields); @@ -563,13 +563,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -580,7 +580,7 @@ public interface RedisHashCommands { * @param fields one or more fields to get the TTL for. * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in seconds; * {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hexpiretime(K key, K... fields); @@ -591,7 +591,7 @@ public interface RedisHashCommands { * @param fields one or more fields to remove the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 1} indicating expiration time is removed; * {@code -1} field has no expiration time to be removed; {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpersist(K key, K... fields); @@ -602,10 +602,10 @@ public interface RedisHashCommands { * @param milliseconds the milliseconds type: long. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, long milliseconds, K... fields); @@ -614,13 +614,13 @@ public interface RedisHashCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, long milliseconds, ExpireArgs expireArgs, K... fields); @@ -631,10 +631,10 @@ public interface RedisHashCommands { * @param milliseconds the milliseconds. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, Duration milliseconds, K... fields); @@ -643,13 +643,13 @@ public interface RedisHashCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is 0; {@code 1} indicating expiration time is - * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not - * met); {@code -2} indicating there is no such field - * @since 7.0 + * already due to expiration, or provided expiry interval is 0; {@code 1} indicating expiration time is set/updated; + * {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not met); + * {@code -2} indicating there is no such field + * @since 6.4 */ List hpexpire(K key, Duration milliseconds, ExpireArgs expireArgs, K... fields); @@ -660,10 +660,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, long timestamp, K... fields); @@ -672,13 +672,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, long timestamp, ExpireArgs expireArgs, K... fields); @@ -689,10 +689,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Date timestamp, K... fields); @@ -701,13 +701,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Date timestamp, ExpireArgs expireArgs, K... fields); @@ -718,10 +718,10 @@ public interface RedisHashCommands { * @param timestamp the milliseconds-timestamp type: posix time. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Instant timestamp, K... fields); @@ -730,13 +730,13 @@ public interface RedisHashCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @param fields one or more fields to set the TTL for. * @return a list of {@link Long} values for each of the fields provided: {@code 2} indicating the specific field is deleted - * already due to expiration, or provided expriry interval is in the past; {@code 1} indicating expiration time is + * already due to expiration, or provided expiry interval is in the past; {@code 1} indicating expiration time is * set/updated; {@code 0} indicating the expiration time is not set (a provided NX | XX | GT | LT condition is not * met); {@code -2} indicating there is no such field - * @since 7.0 + * @since 6.4 */ List hpexpireat(K key, Instant timestamp, ExpireArgs expireArgs, K... fields); @@ -748,7 +748,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: expiration time as a UNIX timestamp in * milliseconds; {@code -1} indicating the field has no expiry time set; {@code -2} indicating there is no such * field - * @since 7.0 + * @since 6.4 */ List hpexpiretime(K key, K... fields); @@ -760,7 +760,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in seconds; or a negative value * in order to signal an error. The command returns {@code -1} if the key exists but has no associated expiration * time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ List httl(K key, K... fields); @@ -772,7 +772,7 @@ public interface RedisHashCommands { * @return a list of {@link Long} values for each of the fields provided: the time to live in milliseconds; or a negative * value in order to signal an error. The command returns {@code -1} if the key exists but has no associated * expiration time. The command returns {@code -2} if the key does not exist. - * @since 7.0 + * @since 6.4 */ List hpttl(K key, K... fields); diff --git a/src/main/templates/io/lettuce/core/api/RedisKeyCommands.java b/src/main/templates/io/lettuce/core/api/RedisKeyCommands.java index bdd3568991..602b0442ad 100644 --- a/src/main/templates/io/lettuce/core/api/RedisKeyCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisKeyCommands.java @@ -108,7 +108,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param seconds the seconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -131,7 +131,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param seconds the seconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set. * @since 6.2 @@ -153,7 +153,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -175,7 +175,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -198,7 +198,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -325,7 +325,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param milliseconds the milliseconds type: long. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -348,7 +348,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param milliseconds the milliseconds. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return integer-reply, specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not exist or * the timeout could not be set. * @since 6.2 @@ -370,7 +370,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -392,7 +392,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 @@ -414,7 +414,7 @@ public interface RedisKeyCommands { * * @param key the key. * @param timestamp the milliseconds-timestamp type: posix time. - * @param expireArgs the expire arguments. + * @param expireArgs the expiry arguments. * @return Boolean integer-reply specifically: {@code true} if the timeout was set. {@code false} if {@code key} does not * exist or the timeout could not be set (see: {@code EXPIRE}). * @since 6.2 diff --git a/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java b/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java index 96e09c3940..eaefbf48f6 100644 --- a/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java +++ b/src/main/templates/io/lettuce/core/api/RedisScriptingCommands.java @@ -92,7 +92,7 @@ public interface RedisScriptingCommands { * @param values the values. * @param expected return type. * @return script result. - * @since 7.0 + * @since 6.4 */ T evalReadOnly(String script, ScriptOutputType type, K[] keys, V... values); From caadbfedeac0c27a316ae6dc8cf5dfaee44530b6 Mon Sep 17 00:00:00 2001 From: Tihomir Krasimirov Mateev Date: Fri, 7 Jun 2024 21:04:54 +0300 Subject: [PATCH 24/28] Modify the release acrtion to call the proper maven target for release, make releasing manually available too (#2885) --- .github/workflows/version-and-release.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/version-and-release.yaml b/.github/workflows/version-and-release.yaml index 7f0fa2cd74..93ee19348b 100644 --- a/.github/workflows/version-and-release.yaml +++ b/.github/workflows/version-and-release.yaml @@ -2,23 +2,25 @@ name: Release on: release: - types: [published] + types: [published] # once a release is published in the GitHub UI + workflow_dispatch: # or manually, by clicking the button jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: 1. Checkout sources + uses: actions/checkout@v4 - - name: get version from tag + - name: 2. Extract version from tag id: get_version run: | realversion="${GITHUB_REF/refs\/tags\//}" realversion="${realversion//v/}" echo "VERSION=$realversion" >> $GITHUB_OUTPUT - - name: Set up publishing to maven central + - name: 3. Set up Java with Maven cache uses: actions/setup-java@v4 with: java-version: '8' @@ -28,20 +30,20 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - - name: mvn versions + - name: 4. Update version in Maven configuration run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }} - - name: Install gpg key + - name: 5. Install GPG key run: | cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - - name: Publish + - name: 6. Publish to Maven run: | mvn --no-transfer-progress \ --batch-mode \ -Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \ - deploy -P release + release:perform env: MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}} - MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}} \ No newline at end of file + MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}} From 74ec22f13c4594be26de41e9853c5b75f255023a Mon Sep 17 00:00:00 2001 From: Thach Le Date: Tue, 11 Jun 2024 09:30:20 +0700 Subject: [PATCH 25/28] Format file --- .../io/lettuce/core/commands/ServerCommandIntegrationTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index e3395454bf..c764db15ad 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -622,4 +622,5 @@ private boolean isCommandReadOnly(String commandName) { CommandDetail detail = details.get(0); return detail.getFlags().contains(CommandDetail.Flag.READONLY) && !detail.getFlags().contains(CommandDetail.Flag.WRITE); } + } From 8fdbd9721e9ad22d3528b5bb5b3838ced4cde25e Mon Sep 17 00:00:00 2001 From: Thach Le Date: Wed, 12 Jun 2024 15:28:47 +0700 Subject: [PATCH 26/28] Using interface method from java 8 instead of java 9 --- .../lettuce/core/commands/ServerCommandIntegrationTests.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index c764db15ad..4aadb01340 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -36,6 +36,7 @@ import io.lettuce.core.cluster.ClusterReadOnlyCommands; import io.lettuce.core.protocol.ProtocolKeyword; import io.lettuce.test.condition.RedisConditions; +import org.assertj.core.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -614,7 +615,7 @@ private boolean isCommandReadOnly(String commandName) { throw new IllegalArgumentException("Command not found: " + commandName); } - List details = CommandDetailParser.parse(List.of(commandInfo)); + List details = CommandDetailParser.parse(Arrays.asList(commandInfo)); if (details.isEmpty()) { throw new IllegalArgumentException("Command details could not be parsed: " + commandName); } From a1ab7efe0773f4ef76469e6aca0ca11c85deaf49 Mon Sep 17 00:00:00 2001 From: Thach Le Date: Wed, 12 Jun 2024 22:53:31 +0700 Subject: [PATCH 27/28] Fix test --- .../lettuce/core/commands/ServerCommandIntegrationTests.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java index 4aadb01340..a64414edf4 100644 --- a/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java +++ b/src/test/java/io/lettuce/core/commands/ServerCommandIntegrationTests.java @@ -36,7 +36,6 @@ import io.lettuce.core.cluster.ClusterReadOnlyCommands; import io.lettuce.core.protocol.ProtocolKeyword; import io.lettuce.test.condition.RedisConditions; -import org.assertj.core.util.Arrays; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -615,13 +614,13 @@ private boolean isCommandReadOnly(String commandName) { throw new IllegalArgumentException("Command not found: " + commandName); } - List details = CommandDetailParser.parse(Arrays.asList(commandInfo)); + List details = CommandDetailParser.parse(commandInfo); if (details.isEmpty()) { throw new IllegalArgumentException("Command details could not be parsed: " + commandName); } CommandDetail detail = details.get(0); - return detail.getFlags().contains(CommandDetail.Flag.READONLY) && !detail.getFlags().contains(CommandDetail.Flag.WRITE); + return !detail.getFlags().contains(CommandDetail.Flag.WRITE); } } From fe2f247bd925d38e36a6b3ab84e84bda0bee64d3 Mon Sep 17 00:00:00 2001 From: Thach Le Date: Wed, 12 Jun 2024 23:01:39 +0700 Subject: [PATCH 28/28] Revert readwrite command to the list COMMAND INFO READWRITE 1) 1) "readwrite" 2) "1" 3) 1) "loading" 2) "stale" 3) "fast" --- src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java | 2 +- .../lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java b/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java index d116b0fb48..81671bf761 100644 --- a/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java +++ b/src/main/java/io/lettuce/core/protocol/ReadOnlyCommands.java @@ -74,7 +74,7 @@ enum CommandName { GEODIST, GEOPOS, GEORADIUS_RO, GEORADIUSBYMEMBER_RO, GEOSEARCH, GEOHASH, GET, GETBIT, // GETRANGE, HEXISTS, HGET, HGETALL, HKEYS, HLEN, HMGET, HRANDFIELD, HSCAN, HSTRLEN, // HVALS, INFO, KEYS, LINDEX, LLEN, LPOS, LRANGE, SORT_RO, MGET, PFCOUNT, PTTL, // - RANDOMKEY, SCAN, SCARD, SCRIPT, // + RANDOMKEY, READWRITE, SCAN, SCARD, SCRIPT, // SDIFF, SINTER, SISMEMBER, SMISMEMBER, SMEMBERS, SRANDMEMBER, SSCAN, STRLEN, // SUNION, TIME, TTL, TYPE, // XINFO, XLEN, XPENDING, XRANGE, XREVRANGE, XREAD, // diff --git a/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java b/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java index 0f7bed34e0..502198b7ae 100644 --- a/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java +++ b/src/test/java/io/lettuce/core/cluster/ClusterReadOnlyCommandsUnitTests.java @@ -16,7 +16,7 @@ class ClusterReadOnlyCommandsUnitTests { @Test void testCount() { - assertThat(ClusterReadOnlyCommands.getReadOnlyCommands()).hasSize(83); + assertThat(ClusterReadOnlyCommands.getReadOnlyCommands()).hasSize(84); } @Test