From f1d5e6755ecde76b1411c60f9a00437c76ec1f82 Mon Sep 17 00:00:00 2001
From: SanHalacogluImproving
<144171266+SanHalacogluImproving@users.noreply.github.com>
Date: Tue, 5 Mar 2024 12:10:21 -0800
Subject: [PATCH] Java: Added examples to documentation for StringCommands.
(#120) (#1068)
* Java: Added examples to documentation for StringCommands. (#120)
* Minor Documentation changes.
* Minor documentation changes.
---
.../glide/api/commands/StringCommands.java | 58 +++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/java/client/src/main/java/glide/api/commands/StringCommands.java b/java/client/src/main/java/glide/api/commands/StringCommands.java
index 97bb98fa31..7431927947 100644
--- a/java/client/src/main/java/glide/api/commands/StringCommands.java
+++ b/java/client/src/main/java/glide/api/commands/StringCommands.java
@@ -22,6 +22,14 @@ public interface StringCommands {
* @param key The key
to retrieve from the database.
* @return Response from Redis. If key
exists, returns the value
of
* key
as a String
. Otherwise, return null
.
+ * @example
+ *
{@code + * String payload = client.get("key").get(); + * assert payload.equals("value"); + * + * String payload = client.get("non_existing_key").get(); + * assert payload.equals(null); + * }*/ CompletableFuture
key
to store.
* @param value The value to store with the given key
.
* @return Response from Redis containing "OK"
.
+ * @example
+ * {@code + * String payload = client.set("key", "value").get(); + * assert payload.equals("OK"); + * }*/ CompletableFuture
null
. If {@link SetOptionsBuilder#returnOldValue(boolean)}
* is set, return the old value as a String
.
+ * @example
+ * {@code + * String payload = + * client.set("key", "value", SetOptions.builder() + * .conditionalSet(ONLY_IF_EXISTS) + * .expiry(SetOptions.Expiry.Seconds(5L)) + * .build()) + * .get(); + * assert payload.equals("OK"); + * }*/ CompletableFuture
keys
.key
is not found, its corresponding value in the list will be null
*
.
+ * @example
+ * {@code + * String payload = client.mget(new String[] {"key1", "key2"}).get(); + * assert payload.equals(new String[] {"value1", "value2"}); + * }*/ CompletableFuture
OK
.
+ * @example
+ * {@code + * String payload = client.mset(Map.of("key1", "value1", "key2", "value2"}).get(); + * assert payload.equals("OK")); + * }*/ CompletableFuture
key
after the increment.
+ * @example
+ * {@code + * Long num = client.incr("key").get(); + * assert num == 5L; + * }*/ CompletableFuture
key
after the increment.
+ * @example
+ * {@code + * Long num = client.incrBy("key", 2).get(); + * assert num == 7L; + * }*/ CompletableFuture
key
after the increment.
+ * @example
+ * {@code + * Long num = client.incrByFloat("key", 0.5).get(); + * assert num == 7.5; + * }*/ CompletableFuture
key
after the decrement.
+ * @example
+ * {@code + * Long num = client.decr("key").get(); + * assert num == 4L; + * }*/ CompletableFuture
key
after the decrement.
+ * @example
+ * {@code + * Long num = client.decrBy("key", 2).get(); + * assert num == 2L; + * }*/ CompletableFuture