Package glide.api.commands
Interface ServerManagementCommands
-
- All Known Implementing Classes:
GlideClient
public interface ServerManagementCommandsSupports commands for the "Server Management" group for a standalone client.- See Also:
- Server Management Commands
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVERSION_VALKEY_APIA keyword forlolwut(int)andlolwut(int, int[]).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.java.util.concurrent.CompletableFuture<java.lang.String>configResetStat()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.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.java.util.concurrent.CompletableFuture<java.lang.Long>dbsize()Returns the number of keys in the currently selected 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>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>info()Gets information and statistics about the server using theInfoOptions.Section.DEFAULToption.java.util.concurrent.CompletableFuture<java.lang.String>info(InfoOptions.Section[] sections)Get information and statistics about the server.
Starting from server version 7, command supports multiple section arguments.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.java.util.concurrent.CompletableFuture<java.lang.String>lolwut()Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<java.lang.String>lolwut(int version)Displays a piece of generative computer art and the Valkey version.java.util.concurrent.CompletableFuture<java.lang.String>lolwut(int[] parameters)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.java.util.concurrent.CompletableFuture<java.lang.String[]>time()Returns the server time.
-
-
-
Field Detail
-
VERSION_VALKEY_API
static final java.lang.String VERSION_VALKEY_API
A keyword forlolwut(int)andlolwut(int, int[]).- See Also:
- Constant Field Values
-
-
Method Detail
-
info
java.util.concurrent.CompletableFuture<java.lang.String> info()
Gets information and statistics about the server using theInfoOptions.Section.DEFAULToption.- Returns:
- A
Stringwith the information for the default sections. - See Also:
- valkey.io for details.
- Example:
String response = client.info().get(); assert response.contains("# Stats");
-
info
java.util.concurrent.CompletableFuture<java.lang.String> info(InfoOptions.Section[] sections)
Get 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.- Returns:
- A
Stringcontaining the information for the sections requested. - See Also:
- valkey.io for details.
- Example:
String response = regularClient.info(new Section[] { Section.STATS }).get(); assert response.contains("total_net_input_bytes");
-
configRewrite
java.util.concurrent.CompletableFuture<java.lang.String> configRewrite()
Rewrites the configuration file with the current configuration.- Returns:
OKwhen the configuration was rewritten properly, otherwise an error is thrown.- See Also:
- valkey.io for details.
- Example:
String response = client.configRewrite().get(); 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.- Returns:
OKto confirm that the statistics were successfully reset.- See Also:
- valkey.io for details.
- Example:
String response = client.configResetStat().get(); 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.- 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");
-
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.- Parameters:
parameters- Amapconsisting of configuration parameters and their respective values to set.- Returns:
OKif all configurations have been successfully set. Otherwise, raises an error.- See Also:
- valkey.io for details.
- Example:
String response = client.configSet(Map.of("timeout", "1000", "maxmemory", "1GB")).get(); assert response.equals("OK");
-
time
java.util.concurrent.CompletableFuture<java.lang.String[]> time()
Returns the server time.- 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]);
-
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.- 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));
-
flushall
java.util.concurrent.CompletableFuture<java.lang.String> flushall()
Deletes all the keys of all the existing databases. This command never fails.- Returns:
OK.- 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.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
String response = client.flushall(ASYNC).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.- Returns:
OK.- 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.- Parameters:
mode- The flushing mode, could be eitherFlushMode.SYNCorFlushMode.ASYNC.- Returns:
OK.- See Also:
- valkey.io for details.
- Example:
String response = client.flushdb(ASYNC).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.- 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.- 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.- 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.- 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");
-
dbsize
java.util.concurrent.CompletableFuture<java.lang.Long> dbsize()
Returns the number of keys in the currently selected database.- Returns:
- The number of keys in the currently selected database.
- See Also:
- valkey.io for details.
- Example:
Long numKeys = client.dbsize().get(); System.out.printf("Number of keys in the current database: %d%n", numKeys);
-
-