diff --git a/java/client/src/main/java/glide/api/commands/GenericBaseCommands.java b/java/client/src/main/java/glide/api/commands/GenericBaseCommands.java index e7a47bf279..adc7f97795 100644 --- a/java/client/src/main/java/glide/api/commands/GenericBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/GenericBaseCommands.java @@ -18,6 +18,11 @@ public interface GenericBaseCommands { * @see redis.io for details. * @param keys The keys we wanted to remove. * @return The number of keys that were removed. + * @example + *
+     * Long num = client.del(new String[] {"key1", "key2"}).get()
+     * assert num == 2l;
+     * 
*/ CompletableFuture del(String[] keys); @@ -29,10 +34,10 @@ public interface GenericBaseCommands { * @return The number of keys that exist. If the same existing key is mentioned in keys * multiple times, it will be counted multiple times. * @example - *

- * long result = client.exists(new String[] {"my_key", "invalid_key"}).get(); + *

+     * Long result = client.exists(new String[] {"my_key", "invalid_key"}).get();
      * assert result == 1L;
-     * 
+     * 
*/ CompletableFuture exists(String[] keys); @@ -46,9 +51,8 @@ public interface GenericBaseCommands { * @param keys The list of keys to unlink. * @return The number of keys that were unlinked. * @example - *

*

-     * long result = client.unlink("my_key").get();
+     * Long result = client.unlink("my_key").get();
      * assert result == 1L;
      * 
*/ diff --git a/java/client/src/main/java/glide/api/commands/GenericClusterCommands.java b/java/client/src/main/java/glide/api/commands/GenericClusterCommands.java index 1fbca154cc..f92d2582ac 100644 --- a/java/client/src/main/java/glide/api/commands/GenericClusterCommands.java +++ b/java/client/src/main/java/glide/api/commands/GenericClusterCommands.java @@ -26,12 +26,13 @@ public interface GenericClusterCommands { * response (such as XREAD), or that change the client's behavior (such as entering * pub/sub mode on RESP2 connections) shouldn't be called using * this function. - * @example Returns a list of all pub/sub clients: - *

- * Object result = client.customCommand(new String[]{ "CLIENT", "LIST", "TYPE", "PUBSUB" }).get(); - * * @param args Arguments for the custom command including the command name. * @return Response from Redis containing an Object. + * @example + *

+     * ClusterValue data = client.customCommand(new String[] {"ping"}).get();
+     * assert ((String) data.getSingleValue()).equals("PONG");
+     * 
      */
     CompletableFuture> customCommand(String[] args);
 
@@ -46,13 +47,16 @@ public interface GenericClusterCommands {
      *     response (such as XREAD), or that change the client's behavior (such as entering
      *     pub/sub mode on RESP2 connections) shouldn't be called using
      *     this function.
-     * @example Returns a list of all pub/sub clients:
-     *     

- * Object result = client.customCommand(new String[]{ "CLIENT", "LIST", "TYPE", "PUBSUB" }, RANDOM).get(); - * * @param args Arguments for the custom command including the command name * @param route Routing configuration for the command * @return Response from Redis containing an Object. + * @example + *

+     * ClusterValue<Object> result = clusterClient.customCommand(new String[]{ "CONFIG", "GET", "maxmemory"}, ALL_NODES).get();
+     * Map<String, Object> payload = result.getMultiValue();
+     * assert ((String) payload.get("node1")).equals("1GB");
+     * assert ((String) payload.get("node2")).equals("100MB");
+     * 
*/ CompletableFuture> customCommand(String[] args, Route route); @@ -73,6 +77,13 @@ public interface GenericClusterCommands { *
  • If the transaction failed due to a WATCH command, exec will * return null. * + * + * @example + *
    +     * ClusterTransaction transaction = new ClusterTransaction().customCommand(new String[] {"info"});
    +     * Object[] result = clusterClient.exec(transaction).get();
    +     * assert ((String) result[0]).contains("# Stats");
    +     * 
    */ CompletableFuture exec(ClusterTransaction transaction); @@ -92,6 +103,14 @@ public interface GenericClusterCommands { *
  • If the transaction failed due to a WATCH command, exec will * return null. * + * + * @example + *
    +     * ClusterTransaction transaction = new ClusterTransaction().ping().info();
    +     * ClusterValue[] result = clusterClient.exec(transaction, RANDOM).get();
    +     * assert ((String) result[0].getSingleValue()).equals("PONG");
    +     * assert ((String) result[1].getSingleValue()).contains("# Stats");
    +     * 
          */
         CompletableFuture[]> exec(ClusterTransaction transaction, Route route);
     }
    diff --git a/java/client/src/main/java/glide/api/commands/GenericCommands.java b/java/client/src/main/java/glide/api/commands/GenericCommands.java
    index 126188457f..aebf099a7e 100644
    --- a/java/client/src/main/java/glide/api/commands/GenericCommands.java
    +++ b/java/client/src/main/java/glide/api/commands/GenericCommands.java
    @@ -28,6 +28,11 @@ public interface GenericCommands {
          *
          * @param args Arguments for the custom command.
          * @return Response from Redis containing an Object.
    +     * @example
    +     *     
    +     * Object response = (String) client.customCommand(new String[] {"ping", "GLIDE"}).get()
    +     * assert ((String) response).equals("GLIDE");
    +     * 
    */ CompletableFuture customCommand(String[] args); @@ -45,6 +50,13 @@ public interface GenericCommands { *
  • If the transaction failed due to a WATCH command, exec will * return null. * + * + * @example + *
    +     * Transaction transaction = new Transaction().customCommand(new String[] {"info"});
    +     * Object[] result = client.exec(transaction).get();
    +     * assert ((String) result[0]).contains("# Stats");
    +     * 
    */ CompletableFuture exec(Transaction transaction); }