Package glide.api.commands
Interface ServerManagementClusterCommands
-
- All Known Implementing Classes:
GlideClusterClient
public interface ServerManagementClusterCommandsSupports commands for the "Server Management Commands" group for a cluster client.- See Also:
- Server Management Commands
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.String[]>aclCat()Returns a list of all ACL categories, or a list of commands within a category.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String[]>aclCat(java.lang.String category)Returns a list of commands within the specified ACL category.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.Long>aclDelUser(java.lang.String[] usernames)Deletes all specified ACL users and terminates their connections.
The command will be routed to all nodes.java.util.concurrent.CompletableFuture<java.lang.String>aclDryRun(java.lang.String username, java.lang.String command, java.lang.String[] args)Simulates the execution of a command by a user without actually executing the command.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>aclGenPass()Generates a random password for ACL users.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>aclGenPass(int bits)Generates a random password with the specified number of bits for ACL users.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.Object>aclGetUser(java.lang.String username)Returns all ACL rules for the specified user.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String[]>aclList()Returns a list of all ACL users and their rules in ACL configuration file format.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>aclLoad()Reloads ACL rules from the configured ACL configuration file.
The command will be routed to all nodes.java.util.concurrent.CompletableFuture<java.lang.Object[]>aclLog()Returns the ACL security events log.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.Object[]>aclLog(int count)Returns the specified number of ACL security events from the log.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>aclSave()Saves the current ACL rules to the configured ACL configuration file.
The command will be routed to all nodes.java.util.concurrent.CompletableFuture<java.lang.String>aclSetUser(java.lang.String username, java.lang.String[] rules)Creates or modifies an ACL user and its rules.
The command will be routed to all nodes.java.util.concurrent.CompletableFuture<java.lang.String[]>aclUsers()Returns a list of all ACL usernames.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>aclWhoami()Returns the username of the current connection.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgrewriteaof()Initiates a background rewrite of the append-only file (AOF).
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgrewriteaof(@NonNull RequestRoutingConfiguration.Route route)Initiates a background rewrite of the append-only file (AOF).
The command will be routed to the nodes defined byroute.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsave()Asynchronously saves the dataset to disk in the background.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsave(@NonNull RequestRoutingConfiguration.Route route)Asynchronously saves the dataset to disk in the background.
The command will be routed to the nodes defined byroute.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsaveCancel()Aborts all in-progress and scheduled background saves.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsaveCancel(@NonNull RequestRoutingConfiguration.Route route)Aborts all in-progress and scheduled background saves.
The command will be routed to the nodes defined byroute.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsaveSchedule()Schedules a background save of the database.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>bgsaveSchedule(@NonNull RequestRoutingConfiguration.Route route)Schedules a background save of the database.
The command will be routed to the nodes defined byroute.java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>>configGet(java.lang.String[] parameters)Get the values of configuration parameters.
Starting from server version 7, command supports multiple parameters.
The command will be sent to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.String>>>configGet(java.lang.String[] parameters, RequestRoutingConfiguration.Route route)Get the values of configuration parameters.
Starting from server version 7, command supports multiple parameters.java.util.concurrent.CompletableFuture<java.lang.String>configResetStat()Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.
The command will be routed automatically to all nodes.java.util.concurrent.CompletableFuture<java.lang.String>configResetStat(RequestRoutingConfiguration.Route route)Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.java.util.concurrent.CompletableFuture<java.lang.String>configRewrite()Rewrites the configuration file with the current configuration.
The command will be routed automatically to all nodes.java.util.concurrent.CompletableFuture<java.lang.String>configRewrite(RequestRoutingConfiguration.Route route)Rewrites the configuration file with the current configuration.java.util.concurrent.CompletableFuture<java.lang.String>configSet(java.util.Map<java.lang.String,java.lang.String> parameters)Sets configuration parameters to the specified values.
Starting from server version 7, command supports multiple parameters.
The command will be sent to all nodes.java.util.concurrent.CompletableFuture<java.lang.String>configSet(java.util.Map<java.lang.String,java.lang.String> parameters, RequestRoutingConfiguration.Route route)Sets configuration parameters to the specified values.
Starting from server version 7, command supports multiple parameters.java.util.concurrent.CompletableFuture<java.lang.Long>dbsize()Returns the number of keys in the database.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<java.lang.Long>dbsize(RequestRoutingConfiguration.Route route)Returns the number of keys in the database.java.util.concurrent.CompletableFuture<java.lang.String>flushall()Deletes all the keys of all the existing databases.java.util.concurrent.CompletableFuture<java.lang.String>flushall(FlushMode mode)Deletes all the keys of all the existing databases.java.util.concurrent.CompletableFuture<java.lang.String>flushall(FlushMode mode, RequestRoutingConfiguration.Route route)Deletes all the keys of all the existing databases.java.util.concurrent.CompletableFuture<java.lang.String>flushall(RequestRoutingConfiguration.Route route)Deletes all the keys of all the existing databases.java.util.concurrent.CompletableFuture<java.lang.String>flushdb()Deletes all the keys of the currently selected database.java.util.concurrent.CompletableFuture<java.lang.String>flushdb(FlushMode mode)Deletes all the keys of the currently selected database.java.util.concurrent.CompletableFuture<java.lang.String>flushdb(FlushMode mode, RequestRoutingConfiguration.Route route)Deletes all the keys of the currently selected database.java.util.concurrent.CompletableFuture<java.lang.String>flushdb(RequestRoutingConfiguration.Route route)Deletes all the keys of the currently selected database.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>info()Gets information and statistics about the server using theInfoOptions.Section.DEFAULToption.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>info(InfoOptions.Section[] sections)Gets information and statistics about the server.
Starting from server version 7, command supports multiple section arguments.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>info(InfoOptions.Section[] sections, RequestRoutingConfiguration.Route route)Gets information and statistics about the server.
Starting from server version 7, command supports multiple section arguments.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>info(RequestRoutingConfiguration.Route route)Gets information and statistics about the server.java.util.concurrent.CompletableFuture<java.lang.Long>lastsave()ReturnsUNIX TIMEof the last DB save timestamp or startup timestamp if no save was made since then.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Long>>lastsave(RequestRoutingConfiguration.Route route)ReturnsUNIX TIMEof the last DB save timestamp or startup timestamp if no save was made since then.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>>latencyHistory(@NonNull java.lang.String event)Returns the latency spike time series for the specified event.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>>latencyHistory(@NonNull java.lang.String event, @NonNull RequestRoutingConfiguration.Route route)Returns the latency spike time series for the specified event.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>>latencyLatest()Reports the latest latency events logged by the server.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>>latencyLatest(@NonNull RequestRoutingConfiguration.Route route)Reports the latest latency events logged by the server.java.util.concurrent.CompletableFuture<java.lang.Long>latencyReset()Resets the latency spike time series for all events.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<java.lang.Long>latencyReset(@NonNull RequestRoutingConfiguration.Route route)Resets the latency spike time series for all events.java.util.concurrent.CompletableFuture<java.lang.Long>latencyReset(@NonNull java.lang.String[] events)Resets the latency spike time series for the specified events.
Ifeventsis empty, resets the latency spike time series for all events.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<java.lang.Long>latencyReset(@NonNull java.lang.String[] events, @NonNull RequestRoutingConfiguration.Route route)Resets the latency spike time series for the specified events.
Ifeventsis empty, resets the latency spike time series for all events.java.util.concurrent.CompletableFuture<java.lang.String>lolwut()Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>lolwut(int version)Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<java.lang.String>lolwut(int[] parameters)Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>lolwut(int[] parameters, RequestRoutingConfiguration.Route route)Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<java.lang.String>lolwut(int version, int[] parameters)Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>lolwut(int version, int[] parameters, RequestRoutingConfiguration.Route route)Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>lolwut(int version, RequestRoutingConfiguration.Route route)Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>lolwut(RequestRoutingConfiguration.Route route)Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>memoryDoctor()Returns a report about memory problems detected by the server.
The command will be routed to all primary nodes by default.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>memoryDoctor(@NonNull RequestRoutingConfiguration.Route route)Returns a report about memory problems detected by the server.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>memoryMallocStats()Returns the internal statistics of the memory allocator.
The command will be routed to all primary nodes by default.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>>memoryMallocStats(@NonNull RequestRoutingConfiguration.Route route)Returns the internal statistics of the memory allocator.java.util.concurrent.CompletableFuture<java.lang.String>memoryPurge()Asks the server to reclaim memory from the allocator back to the operating system.
The command will be routed to all primary nodes by default.java.util.concurrent.CompletableFuture<java.lang.String>memoryPurge(@NonNull RequestRoutingConfiguration.Route route)Asks the server to reclaim memory from the allocator back to the operating system.java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.Object>>>memoryStats()Returns detailed memory consumption statistics of the server.
The command will be routed to all primary nodes by default.java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.Object>>>memoryStats(@NonNull RequestRoutingConfiguration.Route route)Returns detailed memory consumption statistics of the server.java.util.concurrent.CompletableFuture<java.lang.String>save()Synchronously saves the dataset to disk.
The command will be routed to all primary nodes.java.util.concurrent.CompletableFuture<java.lang.String>save(@NonNull RequestRoutingConfiguration.Route route)Synchronously saves the dataset to disk.
The command will be routed to the nodes defined byroute.java.util.concurrent.CompletableFuture<java.lang.String[]>time()Returns the server time.
The command will be routed to a random node.java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>>time(RequestRoutingConfiguration.Route route)Returns the server time.java.util.concurrent.CompletableFuture<java.lang.Long[]>waitaof(long numlocal, long numreplicas, long timeout, RequestRoutingConfiguration.Route route)Blocks the current client until all previous write commands are successfully transferred and acknowledged by at leastnumlocalandnumreplicasof replicas.
-
-
-
Method Detail
-
info
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info()
Gets information and statistics about the server using theInfoOptions.Section.DEFAULToption. The command will be routed to all primary nodes.- Returns:
- A
Map<String, String>with each address as the key and its corresponding value is the information for the node. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> payload = clusterClient.info().get(); // By default, the command is sent to multiple nodes, expecting a MultiValue result. for (Map.Entry<String, String> entry : payload.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue()); }
-
info
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info(RequestRoutingConfiguration.Route route)
Gets information and statistics about the server. If no argument is provided, so theInfoOptions.Section.DEFAULToption is assumed.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
Stringcontaining the information for the default sections. When specifying arouteother than a single node, it returns aMap<String, String>with each address as the key and its corresponding value is the information for the node. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> payload = clusterClient.info(ALL_NODES).get(); // Command sent to all nodes via ALL_NODES route, expecting MultiValue result. for (Map.Entry<String, String> entry : payload.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue()); }
-
info
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info(InfoOptions.Section[] sections)
Gets information and statistics about the server.
Starting from server version 7, command supports multiple section arguments.
The command will be routed to all primary nodes.- Parameters:
sections- A list ofInfoOptions.Sectionvalues specifying which sections of information to retrieve. When no parameter is provided, theInfoOptions.Section.DEFAULToption is assumed.- Returns:
- A
Map<String, String>with each address as the key and its corresponding value is the information of the sections requested for the node. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> payload = clusterClient.info(new Section[] { Section.STATS }).get(); // By default, the command is sent to multiple nodes, expecting a MultiValue result. for (Map.Entry<String, String> entry : payload.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue()); }
-
info
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> info(InfoOptions.Section[] sections, RequestRoutingConfiguration.Route route)
Gets information and statistics about the server.
Starting from server version 7, command supports multiple section arguments.- Parameters:
sections- A list ofInfoOptions.Sectionvalues specifying which sections of information to retrieve. When no parameter is provided, theInfoOptions.Section.DEFAULToption is assumed.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
Stringwith the containing the information for the sections requested. When specifying arouteother than a single node, it returns aMap<String, String>with each address as the key and its corresponding value is the information of the sections requested for the node. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> payload = clusterClient.info(new Section[] { Section.STATS }, RANDOM).get(); // Command sent to a single random node via RANDOM route, expecting SingleValue result. assert data.getSingleValue().contains("total_net_input_bytes");
-
configRewrite
java.util.concurrent.CompletableFuture<java.lang.String> configRewrite()
Rewrites the configuration file with the current configuration.
The command will be routed automatically to all nodes.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configRewrite().get(); assert response.equals("OK");
-
configRewrite
java.util.concurrent.CompletableFuture<java.lang.String> configRewrite(RequestRoutingConfiguration.Route route)
Rewrites the configuration file with the current configuration.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configRewrite(ALL_PRIMARIES).get(); // Expecting an "OK" for all primary nodes. assert response.equals("OK");
-
configResetStat
java.util.concurrent.CompletableFuture<java.lang.String> configResetStat()
Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.
The command will be routed automatically to all nodes.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configResetStat().get(); assert response.equals("OK");
-
configResetStat
java.util.concurrent.CompletableFuture<java.lang.String> configResetStat(RequestRoutingConfiguration.Route route)
Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configResetStat(ALL_PRIMARIES).get(); // Expecting an "OK" for all primary nodes. assert response.equals("OK");
-
configGet
java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,java.lang.String>> configGet(java.lang.String[] parameters)
Get the values of configuration parameters.
Starting from server version 7, command supports multiple parameters.
The command will be sent to a random node.- Parameters:
parameters- Anarrayof configuration parameter names to retrieve values for.- Returns:
- A
mapof values corresponding to the configuration parameters. - See Also:
- valkey.io for details.
- Example:
Map<String, String> configParams = client.configGet(new String[] {"timeout" , "maxmemory"}).get(); assert configParams.get("timeout").equals("1000"); assert configParams.get("maxmemory").equals("1GB");
-
configGet
java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.String>>> configGet(java.lang.String[] parameters, RequestRoutingConfiguration.Route route)
Get the values of configuration parameters.
Starting from server version 7, command supports multiple parameters.- Parameters:
parameters- Anarrayof configuration parameter names to retrieve values for.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
mapof values corresponding to the configuration parameters.
When specifying a route other than a single node, it returns a dictionary where each address is the key and its corresponding node response is the value. - See Also:
- valkey.io for details.
- Example:
Map<String, String> configParams = client.configGet("timeout", RANDOM).get().getSingleValue(); assert configParams.get("timeout").equals("1000"); Map<String, Map<String, String>> configParamsPerNode = client.configGet("maxmemory", ALL_NODES).get().getMultiValue(); assert configParamsPerNode.get("node1.example.com:6379").get("maxmemory").equals("1GB"); assert configParamsPerNode.get("node2.example.com:6379").get("maxmemory").equals("2GB");
-
configSet
java.util.concurrent.CompletableFuture<java.lang.String> configSet(java.util.Map<java.lang.String,java.lang.String> parameters)
Sets configuration parameters to the specified values.
Starting from server version 7, command supports multiple parameters.
The command will be sent to all nodes.- Parameters:
parameters- Amapconsisting of configuration parameters and their respective values to set.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configSet(Map.of("timeout", "1000", "maxmemory", "1GB")).get(); assert response.equals("OK");
-
configSet
java.util.concurrent.CompletableFuture<java.lang.String> configSet(java.util.Map<java.lang.String,java.lang.String> parameters, RequestRoutingConfiguration.Route route)Sets configuration parameters to the specified values.
Starting from server version 7, command supports multiple parameters.- Parameters:
parameters- Amapconsisting of configuration parameters and their respective values to set.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.configSet(Map.of("timeout", "1000", "maxmemory", "1GB"), ALL_PRIMARIES).get(); assert response.equals("OK");
-
time
java.util.concurrent.CompletableFuture<java.lang.String[]> time()
Returns the server time.
The command will be routed to a random node.- Returns:
- The current server time as a
Stringarray with two elements: AUNIX TIMEand the amount of microseconds already elapsed in the current second. The returned array is in a[UNIX TIME, Microseconds already elapsed]format. - See Also:
- valkey.io for details.
- Example:
String[] serverTime = client.time().get(); System.out.println("Server time is: " + serverTime[0] + "." + serverTime[1]);
-
time
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String[]>> time(RequestRoutingConfiguration.Route route)
Returns the server time.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- The current server time as a
Stringarray with two elements: AUNIX TIMEand the amount of microseconds already elapsed in the current second. The returned array is in a[UNIX TIME, Microseconds already elapsed]format. - See Also:
- valkey.io for details.
- Example:
// Command sent to a single random node via RANDOM route, expecting a SingleValue result. String[] serverTime = client.time().get(RANDOM).getSingleValue(); System.out.println("Server time is: " + serverTime[0] + "." + serverTime[1]); // Command sent to all nodes via ALL_NODES route, expecting a MultiValue result. Map<String, String[]> serverTimeForAllNodes = client.time(ALL_NODES).get().getMultiValue(); for(var serverTimePerNode : serverTimeForAllNodes.getMultiValue().entrySet()) { String node = serverTimePerNode.getKey(); String serverTimePerNodeStr = serverTimePerNode.getValue()[0] + "." + serverTimePerNode.getValue()[1]; System.out.println("Server time for node [" + node + "]: " + serverTimePerNodeStr); }
-
lastsave
java.util.concurrent.CompletableFuture<java.lang.Long> lastsave()
ReturnsUNIX TIMEof the last DB save timestamp or startup timestamp if no save was made since then.
The command will be routed to a random node.- Returns:
UNIX TIMEof the last DB save executed with success.- See Also:
- valkey.io for details.
- Example:
Long timestamp = client.lastsave().get(); System.out.printf("Last DB save was done at %s%n", Instant.ofEpochSecond(timestamp));
-
lastsave
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Long>> lastsave(RequestRoutingConfiguration.Route route)
ReturnsUNIX TIMEof the last DB save timestamp or startup timestamp if no save was made since then.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
UNIX TIMEof the last DB save executed with success.- See Also:
- valkey.io for details.
- Example:
ClusterValue<Long> data = client.lastsave(ALL_NODES).get(); for (Map.Entry<String, Long> entry : data.getMultiValue().entrySet()) { System.out.printf("Last DB save on node %s was made at %s%n", entry.getKey(), Instant.ofEpochSecond(entry.getValue())); }
-
save
java.util.concurrent.CompletableFuture<java.lang.String> save()
Synchronously saves the dataset to disk.
The command will be routed to all primary nodes.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.save().get(); assert response.equals("OK");
-
save
java.util.concurrent.CompletableFuture<java.lang.String> save(@NonNull @NonNull RequestRoutingConfiguration.Route route)Synchronously saves the dataset to disk.
The command will be routed to the nodes defined byroute.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.save(ALL_PRIMARIES).get(); assert response.equals("OK");
-
bgsave
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsave()
Asynchronously saves the dataset to disk in the background.
The command will be routed to all primary nodes.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsave().get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgsave
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsave(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Asynchronously saves the dataset to disk in the background.
The command will be routed to the nodes defined byroute.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsave(ALL_PRIMARIES).get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgsaveSchedule
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveSchedule()
Schedules a background save of the database.
The command will be routed to all primary nodes.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsaveSchedule().get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgsaveSchedule
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveSchedule(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Schedules a background save of the database.
The command will be routed to the nodes defined byroute.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsaveSchedule(ALL_PRIMARIES).get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgsaveCancel
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveCancel()
Aborts all in-progress and scheduled background saves.
The command will be routed to all primary nodes.- Returns:
- A
ClusterValue<String>containing status strings. - Since:
- Valkey 8.1
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsaveCancel().get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgsaveCancel
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgsaveCancel(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Aborts all in-progress and scheduled background saves.
The command will be routed to the nodes defined byroute.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
ClusterValue<String>containing status strings. - Since:
- Valkey 8.1
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgsaveCancel(ALL_PRIMARIES).get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background saving"); }
-
bgrewriteaof
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgrewriteaof()
Initiates a background rewrite of the append-only file (AOF).
The command will be routed to all primary nodes.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgrewriteaof().get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background append only file rewriting"); }
-
bgrewriteaof
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> bgrewriteaof(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Initiates a background rewrite of the append-only file (AOF).
The command will be routed to the nodes defined byroute.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A
ClusterValue<String>containing status strings. - See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.bgrewriteaof(ALL_PRIMARIES).get(); for (String value : response.getMultiValue().values()) { assert value.contains("Background append only file rewriting"); }
-
flushall
java.util.concurrent.CompletableFuture<java.lang.String> flushall()
Deletes all the keys of all the existing databases. This command never fails.
The command will be routed to all primary nodes.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.flushall().get(); assert response.equals("OK");
-
flushall
java.util.concurrent.CompletableFuture<java.lang.String> flushall(FlushMode mode)
Deletes all the keys of all the existing databases. This command never fails.
The command will be routed to all primary nodes.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.flushall(ASYNC).get(); assert response.equals("OK");
-
flushall
java.util.concurrent.CompletableFuture<java.lang.String> flushall(RequestRoutingConfiguration.Route route)
Deletes all the keys of all the existing databases. This command never fails.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
Route route = new SlotKeyRoute("key", PRIMARY); String response = client.flushall(route).get(); assert response.equals("OK");
-
flushall
java.util.concurrent.CompletableFuture<java.lang.String> flushall(FlushMode mode, RequestRoutingConfiguration.Route route)
Deletes all the keys of all the existing databases. This command never fails.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
Route route = new SlotKeyRoute("key", PRIMARY); String response = client.flushall(SYNC, route).get(); assert response.equals("OK");
-
flushdb
java.util.concurrent.CompletableFuture<java.lang.String> flushdb()
Deletes all the keys of the currently selected database. This command never fails.
The command will be routed to all primary nodes.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.flushdb().get(); assert response.equals("OK");
-
flushdb
java.util.concurrent.CompletableFuture<java.lang.String> flushdb(FlushMode mode)
Deletes all the keys of the currently selected database. This command never fails.
The command will be routed to all primary nodes.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = client.flushdb(ASYNC).get(); assert response.equals("OK");
-
flushdb
java.util.concurrent.CompletableFuture<java.lang.String> flushdb(RequestRoutingConfiguration.Route route)
Deletes all the keys of the currently selected database. This command never fails.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
Route route = new SlotKeyRoute("key", PRIMARY); String response = client.flushdb(route).get(); assert response.equals("OK");
-
flushdb
java.util.concurrent.CompletableFuture<java.lang.String> flushdb(FlushMode mode, RequestRoutingConfiguration.Route route)
Deletes all the keys of the currently selected database. This command never fails.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
Route route = new SlotKeyRoute("key", PRIMARY); String response = client.flushdb(SYNC, route).get(); assert response.equals("OK");
-
lolwut
java.util.concurrent.CompletableFuture<java.lang.String> lolwut()
Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut().get(); System.out.println(data); assert data.contains("Redis ver. 7.2.3");
-
lolwut
java.util.concurrent.CompletableFuture<java.lang.String> lolwut(int[] parameters)
Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.- Parameters:
parameters- Additional set of arguments in order to change the output:- On Valkey version
5, those are length of the line, number of squares per row, and number of squares per column. - On Valkey version
6, those are number of columns and number of lines. - On other versions parameters are ignored.
- On Valkey version
- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut(new int[] { 40, 20 }).get(); System.out.println(data); assert data.contains("Redis ver. 7.2.3");
-
lolwut
java.util.concurrent.CompletableFuture<java.lang.String> lolwut(int version)
Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.- Parameters:
version- Version of computer art to generate.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut(6).get(); System.out.println(data); assert data.contains("Redis ver. 7.2.3");
-
lolwut
java.util.concurrent.CompletableFuture<java.lang.String> lolwut(int version, int[] parameters)Displays a piece of generative computer art and the Valkey version.
The command will be routed to a random node.- Parameters:
version- Version of computer art to generate.parameters- Additional set of arguments in order to change the output:- For version
5, those are length of the line, number of squares per row, and number of squares per column. - For version
6, those are number of columns and number of lines.
- For version
- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut(6, new int[] { 40, 20 }).get(); System.out.println(data); assert data.contains("Redis ver. 7.2.3"); data = client.lolwut(5, new int[] { 30, 5, 5 }).get(); System.out.println(data); assert data.contains("Redis ver. 7.2.3");
-
lolwut
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut(RequestRoutingConfiguration.Route route)
Displays a piece of generative computer art and the Valkey version.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.lolwut(ALL_NODES).get(); for (String data : response.getMultiValue().values()) { System.out.println(data); assert data.contains("Redis ver. 7.2.3"); }
-
lolwut
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut(int[] parameters, RequestRoutingConfiguration.Route route)
Displays a piece of generative computer art and the Valkey version.- Parameters:
parameters- Additional set of arguments in order to change the output:- On Valkey version
5, those are length of the line, number of squares per row, and number of squares per column. - On Valkey version
6, those are number of columns and number of lines. - On other versions parameters are ignored.
- On Valkey version
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut(new int[] { 40, 20 }, ALL_NODES).get(); for (String data : response.getMultiValue().values()) { System.out.println(data); assert data.contains("Redis ver. 7.2.3"); }
-
lolwut
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut(int version, RequestRoutingConfiguration.Route route)
Displays a piece of generative computer art and the Valkey version.- Parameters:
version- Version of computer art to generate.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> response = client.lolwut(6, ALL_NODES).get(); for (String data : response.getMultiValue().values()) { System.out.println(data); assert data.contains("Redis ver. 7.2.3"); }
-
lolwut
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> lolwut(int version, int[] parameters, RequestRoutingConfiguration.Route route)
Displays a piece of generative computer art and the Valkey version.- Parameters:
version- Version of computer art to generate.parameters- Additional set of arguments in order to change the output:- For version
5, those are length of the line, number of squares per row, and number of squares per column. - For version
6, those are number of columns and number of lines.
- For version
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A piece of generative computer art along with the current Valkey version.
- See Also:
- valkey.io for details.
- Example:
String data = client.lolwut(6, new int[] { 40, 20 }, ALL_NODES).get(); for (String data : response.getMultiValue().values()) { System.out.println(data); assert data.contains("Redis ver. 7.2.3"); } data = client.lolwut(5, new int[] { 30, 5, 5 }, ALL_NODES).get(); for (String data : response.getMultiValue().values()) { System.out.println(data); assert data.contains("Redis ver. 7.2.3"); }
-
dbsize
java.util.concurrent.CompletableFuture<java.lang.Long> dbsize()
Returns the number of keys in the database.
The command will be routed to all primary nodes.- Returns:
- The total number of keys across the primary nodes.
- See Also:
- valkey.io for details.
- Example:
Long numKeys = client.dbsize().get(); System.out.printf("Number of keys across the primary nodes: %d%n", numKeys);
-
dbsize
java.util.concurrent.CompletableFuture<java.lang.Long> dbsize(RequestRoutingConfiguration.Route route)
Returns the number of keys in the database.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- The number of keys in the database.
If the query is routed to multiple nodes, returns the sum of the number of keys across all routed nodes. - See Also:
- valkey.io for details.
- Example:
Route route = new ByAddressRoute("localhost", 8000); Long numKeys = client.dbsize(route).get(); System.out.printf("Number of keys for node at port 8000: %d%n", numKeys);
-
waitaof
java.util.concurrent.CompletableFuture<java.lang.Long[]> waitaof(long numlocal, long numreplicas, long timeout, RequestRoutingConfiguration.Route route)Blocks the current client until all previous write commands are successfully transferred and acknowledged by at leastnumlocalandnumreplicasof replicas. Iftimeoutis reached, the command returns even if the specified number of replicas were not yet reached.- Parameters:
numlocal- The number of local replicas to reach.numreplicas- The number of replicas to reach.timeout- The timeout value specified in milliseconds. A value of0will block indefinitely.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- An
arrayof twoLongvalues: the number of local replicas reached and the number of replicas reached. - Since:
- Valkey 7.2 and above.
- See Also:
- valkey.io for details.
- Example:
String key = "{key}:test"; client.set(key, "value").get(); // Route to the primary node managing this key Route route = new SlotKeyRoute(key, PRIMARY); Long[] result = client.waitaof(1L, 1L, 1000L, route).get(); assert result[0] >= 1L; // At least 1 local replica reached assert result[1] >= 1L; // At least 1 replica reached
-
aclCat
java.util.concurrent.CompletableFuture<java.lang.String[]> aclCat()
Returns a list of all ACL categories, or a list of commands within a category.
The command will be routed to a random node.- Returns:
- An array of ACL categories or commands.
- See Also:
- valkey.io for details.
- Example:
String[] categories = client.aclCat().get(); assert Arrays.asList(categories).contains("string");
-
aclCat
java.util.concurrent.CompletableFuture<java.lang.String[]> aclCat(java.lang.String category)
Returns a list of commands within the specified ACL category.
The command will be routed to a random node.- Parameters:
category- The ACL category to list commands for.- Returns:
- An array of commands within the specified category.
- See Also:
- valkey.io for details.
- Example:
String[] commands = client.aclCat("string").get(); assert Arrays.asList(commands).contains("get");
-
aclDelUser
java.util.concurrent.CompletableFuture<java.lang.Long> aclDelUser(java.lang.String[] usernames)
Deletes all specified ACL users and terminates their connections.
The command will be routed to all nodes.- Parameters:
usernames- An array of usernames to delete.- Returns:
- The number of users deleted.
- See Also:
- valkey.io for details.
- Example:
Long deletedCount = client.aclDelUser(new String[] {"user1", "user2"}).get(); assert deletedCount == 2L;
-
aclDryRun
java.util.concurrent.CompletableFuture<java.lang.String> aclDryRun(java.lang.String username, java.lang.String command, java.lang.String[] args)Simulates the execution of a command by a user without actually executing the command.
The command will be routed to a random node.- Parameters:
username- The username to simulate command execution for.command- The command to simulate.args- The command arguments.- Returns:
"OK"if the user can execute the command, otherwise an error is returned.- See Also:
- valkey.io for details.
- Example:
String result = client.aclDryRun("user1", "get", new String[] {"key"}).get(); assert result.equals("OK");
-
aclGenPass
java.util.concurrent.CompletableFuture<java.lang.String> aclGenPass()
Generates a random password for ACL users.
The command will be routed to a random node.- Returns:
- A randomly generated password string.
- See Also:
- valkey.io for details.
- Example:
String password = client.aclGenPass().get(); assert password.length() == 64; // Default length
-
aclGenPass
java.util.concurrent.CompletableFuture<java.lang.String> aclGenPass(int bits)
Generates a random password with the specified number of bits for ACL users.
The command will be routed to a random node.- Parameters:
bits- The number of bits for the password (must be a multiple of 4, between 1 and 4096).- Returns:
- A randomly generated password string.
- See Also:
- valkey.io for details.
- Example:
String password = client.aclGenPass(128).get(); assert password.length() == 32; // 128 bits = 32 hex characters
-
aclGetUser
java.util.concurrent.CompletableFuture<java.lang.Object> aclGetUser(java.lang.String username)
Returns all ACL rules for the specified user.
The command will be routed to a random node.- Parameters:
username- The username to get ACL rules for.- Returns:
- An array or map describing the ACL rules for the user, or
nullif user doesn't exist. - See Also:
- valkey.io for details.
- Example:
Object userInfo = client.aclGetUser("default").get(); assert userInfo != null;
-
aclList
java.util.concurrent.CompletableFuture<java.lang.String[]> aclList()
Returns a list of all ACL users and their rules in ACL configuration file format.
The command will be routed to a random node.- Returns:
- An array of ACL rules for all users.
- See Also:
- valkey.io for details.
- Example:
String[] aclList = client.aclList().get(); assert aclList.length > 0;
-
aclLoad
java.util.concurrent.CompletableFuture<java.lang.String> aclLoad()
Reloads ACL rules from the configured ACL configuration file.
The command will be routed to all nodes.- Returns:
"OK"on success.- See Also:
- valkey.io for details.
- Example:
String result = client.aclLoad().get(); assert result.equals("OK");
-
aclLog
java.util.concurrent.CompletableFuture<java.lang.Object[]> aclLog()
Returns the ACL security events log.
The command will be routed to a random node.- Returns:
- An array of ACL security events.
- See Also:
- valkey.io for details.
- Example:
Object[] log = client.aclLog().get(); System.out.printf("ACL log has %d entries%n", log.length);
-
aclLog
java.util.concurrent.CompletableFuture<java.lang.Object[]> aclLog(int count)
Returns the specified number of ACL security events from the log.
The command will be routed to a random node.- Parameters:
count- The number of entries to return.- Returns:
- An array of ACL security events.
- See Also:
- valkey.io for details.
- Example:
Object[] log = client.aclLog(10).get(); assert log.length <= 10;
-
aclSave
java.util.concurrent.CompletableFuture<java.lang.String> aclSave()
Saves the current ACL rules to the configured ACL configuration file.
The command will be routed to all nodes.- Returns:
"OK"on success.- See Also:
- valkey.io for details.
- Example:
String result = client.aclSave().get(); assert result.equals("OK");
-
aclSetUser
java.util.concurrent.CompletableFuture<java.lang.String> aclSetUser(java.lang.String username, java.lang.String[] rules)Creates or modifies an ACL user and its rules.
The command will be routed to all nodes.- Parameters:
username- The username for the ACL user.rules- An array of ACL rules to apply to the user.- Returns:
"OK"on success.- See Also:
- valkey.io for details.
- Example:
String result = client.aclSetUser("user1", new String[] {"on", "+get", "~*"}).get(); assert result.equals("OK");
-
aclUsers
java.util.concurrent.CompletableFuture<java.lang.String[]> aclUsers()
Returns a list of all ACL usernames.
The command will be routed to a random node.- Returns:
- An array of ACL usernames.
- See Also:
- valkey.io for details.
- Example:
String[] users = client.aclUsers().get(); assert Arrays.asList(users).contains("default");
-
aclWhoami
java.util.concurrent.CompletableFuture<java.lang.String> aclWhoami()
Returns the username of the current connection.
The command will be routed to a random node.- Returns:
- The username of the current connection.
- See Also:
- valkey.io for details.
- Example:
String username = client.aclWhoami().get(); assert username.equals("default");
-
latencyHistory
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyHistory(@NonNull @NonNull java.lang.String event)
Returns the latency spike time series for the specified event.
The command will be routed to all primary nodes.- Parameters:
event- The name of the latency event (e.g., "command").- Returns:
- A cluster value containing array(s) of arrays representing latency spike entries, or an empty array if the event doesn't exist.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Object[][]> history = clusterClient.latencyHistory("command").get(); for (Map.Entry<String, Object[][]> node : history.getMultiValue().entrySet()) { System.out.println("Node [" + node.getKey() + "]: " + node.getValue().length + " entries"); }
-
latencyHistory
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyHistory(@NonNull @NonNull java.lang.String event, @NonNull @NonNull RequestRoutingConfiguration.Route route)
Returns the latency spike time series for the specified event.- Parameters:
event- The name of the latency event (e.g., "command").route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A cluster value containing array(s) of arrays representing latency spike entries, or an empty array if the event doesn't exist.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Object[][]> history = clusterClient.latencyHistory("command", RANDOM).get(); for (Object[] entry : history.getSingleValue()) { System.out.println("Time: " + entry[0] + ", Latency: " + entry[1]); }
-
latencyLatest
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyLatest()
Reports the latest latency events logged by the server.
The command will be routed to all primary nodes.- Returns:
- A cluster value containing array(s) of arrays representing latency event info.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Object[][]> latest = clusterClient.latencyLatest().get(); for (Map.Entry<String, Object[][]> node : latest.getMultiValue().entrySet()) { System.out.println("Node [" + node.getKey() + "]: " + node.getValue().length + " events"); }
-
latencyLatest
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.Object[][]>> latencyLatest(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Reports the latest latency events logged by the server.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A cluster value containing array(s) of arrays representing latency event info.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Object[][]> latest = clusterClient.latencyLatest(RANDOM).get(); for (Object[] info : latest.getSingleValue()) { System.out.println("Event: " + info[0] + ", Latest duration: " + info[2]); }
-
latencyReset
java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset()
Resets the latency spike time series for all events.
The command will be routed to all primary nodes.- Returns:
- The total number of event time series that were reset across all nodes.
- See Also:
- valkey.io for details.
- Example:
Long count = clusterClient.latencyReset().get(); System.out.println("Reset " + count + " events across the cluster");
-
latencyReset
java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset(@NonNull @NonNull java.lang.String[] events)Resets the latency spike time series for the specified events.
Ifeventsis empty, resets the latency spike time series for all events.
The command will be routed to all primary nodes.- Parameters:
events- The event names to reset.- Returns:
- The total number of event time series that were reset across all nodes.
- See Also:
- valkey.io for details.
- Example:
Long count = clusterClient.latencyReset(new String[] {"command"}).get(); System.out.println("Reset " + count + " events across the cluster");
-
latencyReset
java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset(@NonNull @NonNull RequestRoutingConfiguration.Route route)Resets the latency spike time series for all events.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- The total number of event time series that were reset.
- See Also:
- valkey.io for details.
- Example:
Long count = clusterClient.latencyReset(ALL_PRIMARIES).get(); System.out.println("Reset " + count + " events");
-
latencyReset
java.util.concurrent.CompletableFuture<java.lang.Long> latencyReset(@NonNull @NonNull java.lang.String[] events, @NonNull @NonNull RequestRoutingConfiguration.Route route)Resets the latency spike time series for the specified events.
Ifeventsis empty, resets the latency spike time series for all events.- Parameters:
events- The event names to reset.route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- The total number of event time series that were reset.
- See Also:
- valkey.io for details.
- Example:
Long count = clusterClient.latencyReset(new String[] {"command"}, ALL_PRIMARIES).get(); System.out.println("Reset " + count + " events");
-
memoryDoctor
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> memoryDoctor()
Returns a report about memory problems detected by the server.
The command will be routed to all primary nodes by default.- Returns:
- A cluster value containing the memory diagnostic report(s).
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> report = clusterClient.memoryDoctor().get(); for (Map.Entry<String, String> entry : report.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue()); }
-
memoryDoctor
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> memoryDoctor(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Returns a report about memory problems detected by the server.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A cluster value containing the memory diagnostic report(s).
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> report = clusterClient.memoryDoctor(RANDOM).get(); String singleReport = report.getSingleValue(); System.out.println("Memory report: " + singleReport);
-
memoryMallocStats
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> memoryMallocStats()
Returns the internal statistics of the memory allocator.
The command will be routed to all primary nodes by default.- Returns:
- A cluster value containing the memory allocator statistics.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> stats = clusterClient.memoryMallocStats().get(); for (Map.Entry<String, String> entry : stats.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: " + entry.getValue()); }
-
memoryMallocStats
java.util.concurrent.CompletableFuture<ClusterValue<java.lang.String>> memoryMallocStats(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Returns the internal statistics of the memory allocator.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A cluster value containing the memory allocator statistics.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<String> stats = clusterClient.memoryMallocStats(RANDOM).get(); String singleStats = stats.getSingleValue(); System.out.println("Allocator stats: " + singleStats);
-
memoryPurge
java.util.concurrent.CompletableFuture<java.lang.String> memoryPurge()
Asks the server to reclaim memory from the allocator back to the operating system.
The command will be routed to all primary nodes by default.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = clusterClient.memoryPurge().get(); assert response.equals("OK");
-
memoryPurge
java.util.concurrent.CompletableFuture<java.lang.String> memoryPurge(@NonNull @NonNull RequestRoutingConfiguration.Route route)Asks the server to reclaim memory from the allocator back to the operating system.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
"OK"response on success.- See Also:
- valkey.io for details.
- Example:
String response = clusterClient.memoryPurge(ALL_PRIMARIES).get(); assert response.equals("OK");
-
memoryStats
java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.Object>>> memoryStats()
Returns detailed memory consumption statistics of the server.
The command will be routed to all primary nodes by default.- Returns:
- A cluster value containing a map of memory statistics.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Map<String, Object>> stats = clusterClient.memoryStats().get(); for (Map.Entry<String, Map<String, Object>> entry : stats.getMultiValue().entrySet()) { System.out.println("Node [" + entry.getKey() + "]: total.allocated=" + entry.getValue().get("total.allocated")); }
-
memoryStats
java.util.concurrent.CompletableFuture<ClusterValue<java.util.Map<java.lang.String,java.lang.Object>>> memoryStats(@NonNull @NonNull RequestRoutingConfiguration.Route route)
Returns detailed memory consumption statistics of the server.- Parameters:
route- Specifies the routing configuration for the command. The client will route the command to the nodes defined byroute.- Returns:
- A cluster value containing a map of memory statistics.
- See Also:
- valkey.io for details.
- Example:
ClusterValue<Map<String, Object>> stats = clusterClient.memoryStats(RANDOM).get(); Map<String, Object> singleStats = stats.getSingleValue(); System.out.println("Total allocated: " + singleStats.get("total.allocated"));
-
-