Interface RedisServerCommands
-
- All Known Implementing Classes:
RedisServerConnection
public interface RedisServerCommands
Interface of Redis server commands.- Author:
- Matthew Tropiano
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
bgrewriteaof()
boolean
bgsave()
boolean
clientKill(String ip, int port)
String[]
clientList()
boolean
clientPause(long millis)
String
configGet(String configKey)
boolean
configResetStat()
boolean
configRewrite()
boolean
configSet(String parameter, String value)
long
dbsize()
boolean
flushall()
boolean
flushdb()
String
info()
String
info(String section)
long
lastsave()
boolean
migrate(String host, int port, String key, long destinationDB, long timeout, boolean copy, boolean replace)
RedisObject
object(String subcommand, String key)
EncodingType
objectEncoding(String key)
long
objectIdletime(String key)
long
objectRefcount(String key)
RedisObject
pubsub(String subcommand, String... arguments)
String[]
pubsubChannels(String pattern)
long
pubsubNumpat()
String[]
pubsubNumsub(String... arguments)
boolean
save()
void
shutdown(boolean save)
boolean
slaveof(String host, String port)
boolean
slaveofNoOne()
RedisObject
slowlog(String subcommand, String argument)
RedisObject
slowlogGet(long recentCount)
RedisObject
slowlogLen()
RedisObject
slowlogReset()
long[]
time()
-
-
-
Method Detail
-
bgrewriteaof
boolean bgrewriteaof()
From http://redis.io/commands/bgrewriteaof:
Available since 1.0.0.
Instruct Redis to start an Append Only File rewrite process. The rewrite will create a small optimized version of the current Append Only File.
- Returns:
- always true.
-
bgsave
boolean bgsave()
From http://redis.io/commands/bgsave:
Available since 1.0.0.
Save the DB in background. The OK code is immediately returned. Redis forks, the parent continues to serve the clients, the child saves the DB on disk then exits. A client my be able to check if the operation succeeded using the
lastsave()
command.- Returns:
- always true.
-
clientKill
boolean clientKill(String ip, int port)
From http://redis.io/commands/client-kill:
Available since 2.4.0.
Time complexity: O(N) where N is the number of client connections
The
CLIENT KILL
command closes a given client connection identified by ip:port.- Parameters:
ip
- the IP address or hostname.port
- the port number.- Returns:
- true once the client connection was closed.
-
clientList
String[] clientList()
From http://redis.io/commands/client-list:
Available since 2.4.0.
Time complexity: O(N) where N is the number of client connections
The
CLIENT LIST
command returns information and statistics about the client connections server in a mostly human readable format.- Returns:
- a list of client strings that describe each connection.
-
clientPause
boolean clientPause(long millis)
From http://redis.io/commands/client-pause:
Available since 2.9.50.
Time complexity: O(1)
CLIENT PAUSE
is a connections control command able to suspend all the Redis clients for the specified amount of time (in milliseconds).- Parameters:
millis
- the amount of time in milliseconds.- Returns:
- always true.
-
configGet
String configGet(String configKey)
From http://redis.io/commands/config-get:
Available since 2.0.0.
The
CONFIG GET
command is used to read the configuration parameters of a running Redis server. Not all the configuration parameters are supported in Redis 2.4, while Redis 2.6 can read the whole configuration of a server using this command.- Parameters:
configKey
- the config key.- Returns:
- the config value.
-
configRewrite
boolean configRewrite()
From http://redis.io/commands/config-rewrite:
Available since 2.8.0.
The
CONFIG REWRITE
command rewrites theredis.conf
file the server was started with, applying the minimal changes needed to make it reflecting the configuration currently used by the server, that may be different compared to the original one because of the use of theconfigSet(java.lang.String, java.lang.String)
command.- Returns:
- always true.
-
configSet
boolean configSet(String parameter, String value)
From http://redis.io/commands/config-set:
Available since 2.0.0.
The
CONFIG SET
command is used in order to reconfigure the server at run time without the need to restart Redis. You can change both trivial parameters or switch from one to another persistence option using this command.- Parameters:
parameter
- the parameter.value
- the value.- Returns:
- always true.
-
configResetStat
boolean configResetStat()
From http://redis.io/commands/config-resetstat:
Available since 2.0.0.
Time complexity: O(1)
Resets the statistics reported by Redis using the INFO command.
- Returns:
- always true.
-
dbsize
long dbsize()
From http://redis.io/commands/dbsize:
Available since 1.0.0.
Return the number of keys in the currently-selected database.
- Returns:
- the number of keys.
-
flushall
boolean flushall()
From http://redis.io/commands/flushall:
Available since 1.0.0.
Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.
- Returns:
- always true.
-
flushdb
boolean flushdb()
From http://redis.io/commands/flushdb:
Available since 1.0.0.
Delete all the keys of the currently selected DB. This command never fails.
- Returns:
- true if successful, false otherwise.
-
info
String info()
From http://redis.io/commands/info:
Available since 1.0.0.
The INFO command returns information and statistics about the server in a format that is simple to parse by computers and easy to read by humans.
- Returns:
- a collection of text lines parseable for info.
-
info
String info(String section)
From http://redis.io/commands/info:
Available since 1.0.0.
The INFO command returns information and statistics about the server in a format that is simple to parse by computers and easy to read by humans.
- Parameters:
section
- the section to get info on.- Returns:
- a collection of text lines parseable for info.
-
lastsave
long lastsave()
From http://redis.io/commands/lastsave:
Available since 1.0.0.
Return the UNIX TIME of the last DB save executed with success. A client may check if a
bgsave()
command succeeded reading thelastsave()
value, then issuing abgsave()
command and checking at regular intervals every N seconds iflastsave()
changed.- Returns:
- a UNIX time stamp.
-
migrate
boolean migrate(String host, int port, String key, long destinationDB, long timeout, boolean copy, boolean replace)
From http://redis.io/commands/migrate:
Available since 2.6.0.
Time complexity: This command actually executes a
RedisConnectionCommands.dump(java.lang.String)
andRedisConnectionCommands.del(java.lang.String, java.lang.String...)
in the source instance, and aRedisConnectionCommands.restore(java.lang.String, long, java.lang.String)
in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed.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:
host
- the hostname/address of the target server.port
- the port.key
- the key to migrate.destinationDB
- the database to target on the server.timeout
- the timeout for the connection.copy
- if true, the key is copied, not removed from the source.replace
- if true, the remote key is replaced.- Returns:
- always true.
-
object
RedisObject object(String subcommand, String key)
From http://redis.io/commands/object:
Available since 2.2.3.
Time complexity: O(1).
The
object
command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by theobject
command to implement application level key eviction policies when using Redis as a Cache.This call is here in order to support commands that don't have signatures.
- Parameters:
subcommand
- the object subcommand.key
- the key to operate on.- Returns:
- the Redis object returned.
-
objectRefcount
long objectRefcount(String key)
From http://redis.io/commands/object:
Available since 2.2.3.
Time complexity: O(1).
The
object
command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by theobject
command to implement application level key eviction policies when using Redis as a Cache.- Parameters:
key
- the key to count.- Returns:
- the number of references of the value associated with the specified key. This command is mainly useful for debugging.
-
objectEncoding
EncodingType objectEncoding(String key)
From http://redis.io/commands/object:
Available since 2.2.3.
Time complexity: O(1).
The
object
command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by theobject
command to implement application level key eviction policies when using Redis as a Cache.- Parameters:
key
- the key to inspect.- Returns:
- the kind of internal representation used in order to store the value associated with a key, or null for missing key.
-
objectIdletime
long objectIdletime(String key)
From http://redis.io/commands/object:
Available since 2.2.3.
Time complexity: O(1).
The
object
command allows to inspect the internals of Redis Objects associated with keys. It is useful for debugging or to understand if your keys are using the specially encoded data types to save space. Your application may also use the information reported by theobject
command to implement application level key eviction policies when using Redis as a Cache.- Parameters:
key
- the key to inspect.- Returns:
- the number of seconds since the object stored at the specified key is idle (not requested by read or write operations). While the value is returned in seconds the actual resolution of this timer is 10 seconds, but may vary in future implementations.
-
pubsub
RedisObject pubsub(String subcommand, String... arguments)
From http://redis.io/commands/pubsub:
Available since 2.8.0.
Time complexity: O(N) for the CHANNELS subcommand, where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns). O(N) for the NUMSUB subcommand, where N is the number of requested channels. O(1) for the NUMPAT subcommand.
The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.
This call is here in order to support commands that don't have signatures.
- Parameters:
subcommand
- the pubsub subcommand.arguments
- the additional arguments.- Returns:
- the Redis object returned.
-
pubsubChannels
String[] pubsubChannels(String pattern)
From http://redis.io/commands/pubsub:
Available since 2.8.0.
Time complexity: O(N), where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns).
The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.
- Parameters:
pattern
- the pattern to search for.- Returns:
- a list of active channels, optionally matching the specified pattern.
-
pubsubNumsub
String[] pubsubNumsub(String... arguments)
From http://redis.io/commands/pubsub:
Available since 2.8.0.
Time complexity: O(N), where N is the number of requested channels.
The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.
- Parameters:
arguments
- the channel names.- Returns:
- a list of channels and number of subscribers for every channel. The format is channel, count, channel, count, ..., so the list is flat. The order in which the channels are listed is the same as the order of the channels specified in the command call.
-
pubsubNumpat
long pubsubNumpat()
From http://redis.io/commands/pubsub:
Available since 2.8.0.
Time complexity: O(1) for the NUMPAT subcommand.
The PUBSUB command is an introspection command that allows to inspect the state of the Pub/Sub subsystem.
- Returns:
- the number of patterns all the clients are subscribed to.
-
save
boolean save()
From http://redis.io/commands/save:
Available since 1.0.0.
The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file.
- Returns:
- always true.
-
shutdown
void shutdown(boolean save)
From http://redis.io/commands/shutdown:
Available since 1.0.0.
The command behavior is the following:
- Parameters:
save
- if true, force save before shutdown.
-
slaveof
boolean slaveof(String host, String port)
From http://redis.io/commands/slaveof:
Available since 1.0.0.
The
SLAVEOF
command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, the commandSLAVEOF
NO ONE will turn off the replication, turning the Redis server into a MASTER. In the proper formslaveof(String, String)
hostname port will make the server a slave of another server listening at the specified hostname and port.- Parameters:
host
- the hostname.port
- the port.- Returns:
- always true.
-
slaveofNoOne
boolean slaveofNoOne()
From http://redis.io/commands/slaveof:
Available since 1.0.0.
The
SLAVEOF
command can change the replication settings of a slave on the fly. If a Redis server is already acting as slave, the commandSLAVEOF
NO ONE will turn off the replication, turning the Redis server into a MASTER. In the proper formslaveof(String, String)
hostname port will make the server a slave of another server listening at the specified hostname and port.- Returns:
- always true.
-
slowlog
RedisObject slowlog(String subcommand, String argument)
From http://redis.io/commands/slowlog:
Available since 2.2.12.
This command is used in order to read and reset the Redis slow queries log.
- Parameters:
subcommand
- the slowlog subcommand.argument
- the command argument.- Returns:
- the object returned.
-
slowlogGet
RedisObject slowlogGet(long recentCount)
From http://redis.io/commands/slowlog:
Available since 2.2.12.
This command is used in order to read and reset the Redis slow queries log.
- Parameters:
recentCount
- the amount of recent entries to view.- Returns:
- the object returned.
-
slowlogLen
RedisObject slowlogLen()
From http://redis.io/commands/slowlog:
Available since 2.2.12.
Gets just the length of the slow log.
- Returns:
- the object returned.
-
slowlogReset
RedisObject slowlogReset()
From http://redis.io/commands/slowlog:
Available since 2.2.12.
Resets the slow log. Once deleted the information is lost forever.
- Returns:
- the object returned.
-
time
long[] time()
From http://redis.io/commands/time:
Available since 2.6.0.
Time complexity: O(1)
The TIME command returns the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second. Basically the interface is very similar to the one of the
gettimeofday
system call.- Returns:
- UNIX time in seconds, microseconds.
-
-