Interface RedisServerCommands
- All Known Subinterfaces:
DefaultedRedisClusterConnection,DefaultedRedisConnection,RedisClusterConnection,RedisClusterServerCommands,RedisCommands,RedisConnection,RedisConnectionUtils.RedisConnectionProxy,StringRedisConnection
- All Known Implementing Classes:
AbstractRedisConnection,DefaultStringRedisConnection,JedisClusterConnection,JedisConnection,LettuceClusterConnection,LettuceConnection
public interface RedisServerCommands
Server-specific commands supported by Redis.
- Author:
- Costin Leau, Christoph Strobl, Thomas Darimont, Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enum -
Method Summary
Modifier and TypeMethodDescriptionvoidStart an Append Only File rewrite process on server.voidbgSave()Start background saving of db on server.default voidDeprecated.dbSize()Get the total number of available keys in currently selected database.voidflushAll()Delete all all keys from all databases.voidflushDb()Delete all keys of the currently selected database.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, RedisNode target, int dbIndex, RedisServerCommands.MigrateOption option) Atomically transfer a key from a source Redis instance to a destination Redis instance.voidmigrate(byte[] key, RedisNode target, int dbIndex, RedisServerCommands.MigrateOption option, long timeout) Atomically transfer a key from a source Redis instance to a destination Redis instance.voidReset statistic counters on server.voidRewrites theredis.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.voidChange redis replication setting to new master.voidChange server into master.default Longtime()Request server timestamp usingTIMEcommand inTimeUnit.MILLISECONDS.Request server timestamp usingTIMEcommand.
-
Method Details
-
bgWriteAof
Deprecated.As of 1.3, usebgReWriteAof().Start an Append Only File rewrite process on server.- See Also:
-
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:
-
flushAll
void flushAll()Delete all all keys from all databases.- 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 theredis.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:
ListofRedisClientInfoobjects or null when used in pipeline / transaction.- Since:
- 1.3
- See Also:
-
slaveOf
Change redis replication setting to new master.- Parameters:
host- must not be null.port-- Since:
- 1.3
- See Also:
-
slaveOfNoOne
void slaveOfNoOne()Change server into master.- Since:
- 1.3
- See Also:
-
migrate
void migrate(byte[] key, RedisNode target, int dbIndex, @Nullable RedisServerCommands.MigrateOption option) Atomically transfer a key from a source Redis instance to a destination Redis 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 toRedisServerCommands.MigrateOption.COPY.- Since:
- 1.7
- See Also:
-
migrate
void migrate(byte[] key, RedisNode target, int dbIndex, @Nullable RedisServerCommands.MigrateOption option, long timeout) Atomically transfer a key from a source Redis instance to a destination Redis 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 toRedisServerCommands.MigrateOption.COPY.timeout-- Since:
- 1.7
- See Also:
-
bgReWriteAof().