Skip to content

Commit

Permalink
updating javadoc + adding cross-slot test for msetnex
Browse files Browse the repository at this point in the history
  • Loading branch information
TJ Zhang committed Jun 11, 2024
1 parent a3fe4a6 commit 4c58611
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,18 @@ public interface StringBaseCommands {
CompletableFuture<String> mset(Map<String, String> 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 <code>
* keyValueMap</code> map to different hash slots.
* @apiNote When in cluster mode, all keys in <code>keyValueMap</code> must map to the same hash
* slot.
* @see <a href="https://redis.io/commands/msetnx/">redis.io</a> for details.
* @param keyValueMap A key-value map consisting of keys and their respective values to set.
* @return <code>true</code> if all keys were set, <code>false</code> if no key was set.
* @return <code>true</code> if all keys were set. <code>false</code> if no key was set.
* @example
* <pre>{@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);
* }</pre>
*/
CompletableFuture<Boolean> msetnx(Map<String, String> keyValueMap);
Expand Down
3 changes: 2 additions & 1 deletion java/integTest/src/test/java/glide/cluster/CommandTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,8 @@ public static Stream<Arguments> 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
Expand Down

0 comments on commit 4c58611

Please sign in to comment.