From 7e2bb1e381584738bf0d2bd85af33734f72d9d1e Mon Sep 17 00:00:00 2001 From: Poison Date: Mon, 26 Sep 2022 22:40:29 +0800 Subject: [PATCH 1/2] Improve jedis.get doc Added documentation for returning NULL. Reference: [SET | Redis](https://redis.io/commands/set/#return) --- src/main/java/redis/clients/jedis/Jedis.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index e57dabc307..5e5385f65c 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -387,8 +387,11 @@ public String set(final byte[] key, final byte[] value) { * GB). * @param key * @param value - * @param params - * @return OK + * @param params NX|XX, NX -- Only set the key if it does not already exist. XX -- Only set the + * key if it already exists. EX|PX, expire time units: EX = seconds; PX = milliseconds + * @return simple-string-reply {@code OK} if {@code SET} was executed correctly, or {@code null} + * if the {@code SET} operation was not performed because the user specified the NX or XX option + * but the condition was not met. */ @Override public String set(final byte[] key, final byte[] value, final SetParams params) { @@ -4884,7 +4887,9 @@ public String set(final String key, final String value) { * @param value * @param params NX|XX, NX -- Only set the key if it does not already exist. XX -- Only set the * key if it already exists. EX|PX, expire time units: EX = seconds; PX = milliseconds - * @return OK + * @return simple-string-reply {@code OK} if {@code SET} was executed correctly, or {@code null} + * if the {@code SET} operation was not performed because the user specified the NX or XX option + * but the condition was not met. */ @Override public String set(final String key, final String value, final SetParams params) { From 912980bea9c9295b54863dd5cf7680b6aecf119e Mon Sep 17 00:00:00 2001 From: Poison Date: Tue, 27 Sep 2022 00:16:44 +0800 Subject: [PATCH 2/2] Improve StringCommands#set doc --- .../java/redis/clients/jedis/commands/StringCommands.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/redis/clients/jedis/commands/StringCommands.java b/src/main/java/redis/clients/jedis/commands/StringCommands.java index 6be8c31d99..9fd912a151 100644 --- a/src/main/java/redis/clients/jedis/commands/StringCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringCommands.java @@ -32,7 +32,9 @@ public interface StringCommands { * @param key * @param value * @param params {@link SetParams} - * @return OK + * @return simple-string-reply {@code OK} if {@code SET} was executed correctly, or {@code null} + * if the {@code SET} operation was not performed because the user specified the NX or XX option + * but the condition was not met. */ String set(String key, String value, SetParams params);