public interface ServerCommands
Modifier and Type | Method and Description |
---|---|
String |
auth(String password)
Request for authentication in a password-protected Redis server.
|
String |
auth(String user,
String password)
Request for authentication with username and password, based on the ACL feature introduced in
Redis 6.0 see https://redis.io/topics/acl
|
String |
bgrewriteaof()
Instruct Redis to start an Append Only File rewrite process.
|
String |
bgsave()
Save the DB in background.
|
byte[] |
echo(byte[] arg) |
String |
echo(String string) |
String |
flushAll()
Delete all the keys of all the existing databases, not just the currently selected one.
|
String |
flushAll(FlushMode flushMode)
Delete all the keys of all the existing databases, not just the currently selected one.
|
String |
flushDB()
Delete all the keys of the currently selected DB.
|
String |
info()
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.
|
String |
info(String section)
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.
|
long |
lastsave()
Return the UNIX TIME of the last DB save executed with success.
|
String |
ping()
This command is often used to test if a connection is still alive, or to measure latency.
|
String |
ping(String message) |
String |
quit()
Ask the server to close the connection.
|
String |
save()
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.
|
void |
shutdown()
Stop all the client.
|
void |
shutdown(SaveMode saveMode) |
String |
slaveof(String host,
int port)
The SLAVEOF command can change the replication settings of a slave on the fly.
|
String |
slaveofNoOne()
SLAVEOF NO ONE will stop replication, turning the server into a MASTER, but will not discard
the replication.
|
long |
waitReplicas(int replicas,
long timeout)
Syncrhonous replication of Redis as described here: http://antirez.com/news/66.
|
String ping()
byte[] echo(byte[] arg)
String quit()
String flushDB()
String flushAll()
String flushAll(FlushMode flushMode)
flushMode
- String auth(String password)
password
- String auth(String user, String password)
user
- password
- String save()
String bgsave()
String bgrewriteaof()
long lastsave()
void shutdown() throws JedisException
JedisException
- only in case of error.void shutdown(SaveMode saveMode) throws JedisException
saveMode
- modifier to alter the data save behavior of SHUTDOWN. null
would
trigger the default behavior.JedisException
SaveMode
String info()
String info(String section)
section
- (all: Return all sections, default: Return only the default set of sections,
server: General information about the Redis server, clients: Client connections
section, memory: Memory consumption related information, persistence: RDB and AOF
related information, stats: General statistics, replication: Master/slave replication
information, cpu: CPU consumption statistics, commandstats: Redis command statistics,
cluster: Redis Cluster section, keyspace: Database related statistics)String slaveof(String host, int port)
host
- listening at the specified hostnameport
- server listening at the specified portString slaveofNoOne()
long waitReplicas(int replicas, long timeout)
Blocks until all the previous write commands are successfully transferred and acknowledged by at least the specified number of replicas. If the timeout, specified in milliseconds, is reached, the command returns even if the specified number of replicas were not yet reached.
Since Java Object class has implemented wait
method, we cannot use it.
replicas
- successfully transferred and acknowledged by at least the specified number of
replicastimeout
- the time to block in milliseconds, a timeout of 0 means to block foreverCopyright © 2021. All rights reserved.