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, Dennis Neufeld
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
static enum
static enum
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Start an Append Only File rewrite process on server.void
bgSave()
Start background saving of db on server.dbSize()
Get the total number of available keys in currently selected database.void
flushAll()
Delete all all keys from all databases.void
Delete all all keys from all databases using the specifiedRedisServerCommands.FlushOption
.void
flushDb()
Delete all keys of the currently selected database.void
Delete all keys of the currently selected database using the specifiedRedisServerCommands.FlushOption
.Request information and statistics about connected clients.Returns the name of the current connection.Load configuration parameters for givenpattern
from server.info()
Load default server information like memory cpu utilization replicationLoad server information for givenselection
.void
killClient
(String host, int port) Closes a given client connection identified by host:port.lastSave()
Get time of lastbgSave()
operation in seconds.void
migrate
(byte[] key, RedisNode target, int dbIndex, RedisServerCommands.MigrateOption option) Atomically transfer a key from a source Redis instance to a destination Redis instance.void
migrate
(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.void
Change redis replication setting to new master.void
Change server into master.void
Reset statistic counters on server.void
Rewrites theredis.conf
file.void
save()
Synchronous save current db snapshot on server.void
setClientName
(byte[] name) Assign given name to current connection.void
Set server configuration forparam
tovalue
.void
shutdown()
Shutdown server.void
Shutdown server.default Long
time()
Request server timestamp usingTIME
command inTimeUnit.MILLISECONDS
.Request server timestamp usingTIME
command.
-
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 specifiedRedisServerCommands.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 specifiedRedisServerCommands.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 givenpattern
from server.- Parameters:
pattern
- must not be null.- Returns:
- null when used in pipeline / transaction.
- See Also:
-
setConfig
Set server configuration forparam
tovalue
.- 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.conf
file.- Since:
- 2.5
- See Also:
-
time
Request server timestamp usingTIME
command inTimeUnit.MILLISECONDS
.- Returns:
- current server time in milliseconds or null when used in pipeline / transaction.
- Since:
- 1.1
- See Also:
-
time
Request server timestamp usingTIME
command.- Parameters:
timeUnit
- target unit.- Returns:
- current server time in
TimeUnit
or 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:
List
ofRedisClientInfo
objects or null when used in pipeline / transaction.- Since:
- 1.3
- See Also:
-
replicaOf
Change redis 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, 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:
-