Interface ValkeyServerCommands
- All Known Subinterfaces:
DefaultedValkeyClusterConnection,DefaultedValkeyConnection,StringValkeyConnection,ValkeyClusterConnection,ValkeyClusterServerCommands,ValkeyCommands,ValkeyConnection,ValkeyConnectionUtils.ValkeyConnectionProxy
- All Known Implementing Classes:
AbstractValkeyConnection,DefaultStringValkeyConnection,JedisClusterConnection,JedisConnection,LettuceClusterConnection,LettuceConnection,ValkeyGlideClusterConnection,ValkeyGlideClusterServerCommands,ValkeyGlideConnection,ValkeyGlideServerCommands
public interface ValkeyServerCommands
Server-specific commands supported by Valkey.
- Author:
- Costin Leau, Christoph Strobl, Thomas Darimont, Mark Paluch, Dennis Neufeld
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptionvoidStart an Append Only File rewrite process on server.voidbgSave()Start background saving of db on server.dbSize()Get the total number of available keys in currently selected database.voidflushAll()Delete all all keys from all databases.voidDelete all all keys from all databases using the specifiedValkeyServerCommands.FlushOption.voidflushDb()Delete all keys of the currently selected database.voidDelete all keys of the currently selected database using the specifiedValkeyServerCommands.FlushOption.Request information and statistics about connected clients.Returns the name of the current connection.Load configuration parameters for givenpatternfrom server.info()Load default server information like memory cpu utilization replicationLoad server information for givenselection.voidkillClient(String host, int port) Closes a given client connection identified by host:port.lastSave()Get time of lastbgSave()operation in seconds.voidmigrate(byte[] key, ValkeyNode target, int dbIndex, ValkeyServerCommands.MigrateOption option) Atomically transfer a key from a source Valkey instance to a destination Valkey instance.voidmigrate(byte[] key, ValkeyNode target, int dbIndex, ValkeyServerCommands.MigrateOption option, long timeout) Atomically transfer a key from a source Valkey instance to a destination Valkey instance.voidChange valkey replication setting to new master.voidChange server into master.voidReset statistic counters on server.voidRewrites thevalkey.conffile.voidsave()Synchronous save current db snapshot on server.voidsetClientName(byte[] name) Assign given name to current connection.voidSet server configuration forparamtovalue.voidshutdown()Shutdown server.voidShutdown server.default Longtime()Request server timestamp usingTIMEcommand inTimeUnit.MILLISECONDS.Request server timestamp usingTIMEcommand.
-
Method Details
-
bgReWriteAof
void bgReWriteAof()Start an Append Only File rewrite process on server.- Since:
- 1.3
- See Also:
-
bgSave
void bgSave()Start background saving of db on server.- See Also:
-
lastSave
Get time of lastbgSave()operation in seconds.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
save
void save()Synchronous save current db snapshot on server.- See Also:
-
dbSize
Get the total number of available keys in currently selected database.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
flushDb
void flushDb()Delete all keys of the currently selected database.- See Also:
-
flushDb
Delete all keys of the currently selected database using the specifiedValkeyServerCommands.FlushOption.- Parameters:
option-- Since:
- 2.7
- See Also:
-
flushAll
void flushAll()Delete all all keys from all databases.- See Also:
-
flushAll
Delete all all keys from all databases using the specifiedValkeyServerCommands.FlushOption.- Parameters:
option-- Since:
- 2.7
- See Also:
-
info
Load default server information like- memory
- cpu utilization
- replication
- Returns:
- null when used in pipeline / transaction.
- See Also:
-
info
Load server information for givenselection.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
shutdown
void shutdown()Shutdown server.- See Also:
-
shutdown
Shutdown server.- Since:
- 1.3
- See Also:
-
getConfig
Load configuration parameters for givenpatternfrom server.- Parameters:
pattern- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
setConfig
Set server configuration forparamtovalue.- Parameters:
param- must not be null.value- must not be null.- See Also:
-
resetConfigStats
void resetConfigStats()Reset statistic counters on server.
Counters can be retrieved usinginfo().- See Also:
-
rewriteConfig
void rewriteConfig()Rewrites thevalkey.conffile.- Since:
- 2.5
- See Also:
-
time
Request server timestamp usingTIMEcommand inTimeUnit.MILLISECONDS.- Returns:
- current server time in milliseconds or null when used in pipeline / transaction.
- Since:
- 1.1
- See Also:
-
time
Request server timestamp usingTIMEcommand.- Parameters:
timeUnit- target unit.- Returns:
- current server time in
TimeUnitor null when used in pipeline / transaction. - Since:
- 2.5
- See Also:
-
killClient
Closes a given client connection identified by host:port.- Parameters:
host- of connection to close.port- of connection to close- Since:
- 1.3
- See Also:
-
setClientName
void setClientName(byte[] name) Assign given name to current connection.- Parameters:
name-- Since:
- 1.3
- See Also:
-
getClientName
Returns the name of the current connection.- Returns:
- null when used in pipeline / transaction.
- Since:
- 1.3
- See Also:
-
getClientList
Request information and statistics about connected clients.- Returns:
ListofValkeyClientInfoobjects or null when used in pipeline / transaction.- Since:
- 1.3
- See Also:
-
replicaOf
Change valkey replication setting to new master.- Parameters:
host- must not be null.port-- Since:
- 3.0
- See Also:
-
replicaOfNoOne
void replicaOfNoOne()Change server into master.- Since:
- 1.3
- See Also:
-
migrate
void migrate(byte[] key, ValkeyNode target, int dbIndex, @Nullable ValkeyServerCommands.MigrateOption option) Atomically transfer a key from a source Valkey instance to a destination Valkey instance. On success the key is deleted from the original instance and is guaranteed to exist in the target instance.- Parameters:
key- must not be null.target- must not be null.dbIndex-option- can be null. Defaulted toValkeyServerCommands.MigrateOption.COPY.- Since:
- 1.7
- See Also:
-
migrate
void migrate(byte[] key, ValkeyNode target, int dbIndex, @Nullable ValkeyServerCommands.MigrateOption option, long timeout) Atomically transfer a key from a source Valkey instance to a destination Valkey instance. On success the key is deleted from the original instance and is guaranteed to exist in the target instance.- Parameters:
key- must not be null.target- must not be null.dbIndex-option- can be null. Defaulted toValkeyServerCommands.MigrateOption.COPY.timeout-- Since:
- 1.7
- See Also:
-