diff --git a/java/client/src/main/java/glide/api/commands/StringBaseCommands.java b/java/client/src/main/java/glide/api/commands/StringBaseCommands.java index d753602818..2a96342216 100644 --- a/java/client/src/main/java/glide/api/commands/StringBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/StringBaseCommands.java @@ -157,20 +157,18 @@ public interface StringBaseCommands { CompletableFuture mset(Map keyValueMap); /** - * Sets multiple keys to multiple values in a single operation. Performs not operation at all even - * if just a single key already exists. + * Sets multiple keys to values if the key does not exist. The operation is atomic, and if one or + * more keys already exist, the entire operation fails. * - * @apiNote When in cluster mode, the command may route to multiple nodes when keys in - * keyValueMap map to different hash slots. + * @apiNote When in cluster mode, all keys in keyValueMap must map to the same hash + * slot. * @see redis.io for details. * @param keyValueMap A key-value map consisting of keys and their respective values to set. - * @return true if all keys were set, false if no key was set. + * @return true if all keys were set. false if no key was set. * @example *
{@code
      * Boolean result = client.msetnx(Map.of("key1", "value1", "key2", "value2"}).get();
      * assertTrue(result);
-     * Boolean result = client.msetnx(Map.of("key1", "value1", "key2", "value2"}).get();
-     * assertFalse(result);
      * }
*/ CompletableFuture msetnx(Map keyValueMap); diff --git a/java/integTest/src/test/java/glide/cluster/CommandTests.java b/java/integTest/src/test/java/glide/cluster/CommandTests.java index c19f708647..289009fd26 100644 --- a/java/integTest/src/test/java/glide/cluster/CommandTests.java +++ b/java/integTest/src/test/java/glide/cluster/CommandTests.java @@ -749,7 +749,8 @@ public static Stream callCrossSlotCommandsWhichShouldFail() { "sintercard", "7.0.0", clusterClient.sintercard(new String[] {"abc", "def"}, 1)), Arguments.of( "xread", null, clusterClient.xread(Map.of("abc", "stream1", "zxy", "stream2"))), - Arguments.of("copy", "6.2.0", clusterClient.copy("abc", "def", true))); + Arguments.of("copy", "6.2.0", clusterClient.copy("abc", "def", true)), + Arguments.of("msetnx", null, clusterClient.msetnx(Map.of("abc", "def", "ghi", "jkl")))); } @SneakyThrows