Command Format |
Time Complexity |
Command description |
Return Value |
Time |
O (1) |
Returns the current server time. |
The first string is the current timestamp. The second string is the number of milliseconds that have elapsed in the first second. |
Dbsize |
O (1) |
Returns the number of keys of the current database. |
Quantity |
Bgrewriteaof |
O (N) |
Asynchronously rewrite the aof file in the background to reflect the status of the current database |
Feedback |
Bgsave |
O (N) |
Asynchronously saves the data of the current database to the disk in the background. The client can use the LASTSAVE command to view related information and determine whether the BGSAVE command is successfully executed. |
Feedback |
Save |
O (N) |
Synchronously Save the data of the current database to the disk |
OK is returned when the storage is successful. |
Lastsave |
O (1) |
Returns the last timestamp when redis successfully saved the data to the disk. |
A unix Timestamp |
Slaveof host port |
O (n) O (1) |
Dynamically modify the replication function when redis is running. You can change the current server to the slave server of the specified server. If the current server is already a slave server of a master server, running the slaveof host port will stop the current server from synchronizing the old master server and discard the old dataset, in turn, start to synchronize the new master server. O (n) If the command slaveof no one is executed on a slave server, the slave server will disable the replication function and switch from the slave server to the master server. The original synchronized dataset will not be discarded. O (1) |
Always Return OK |
Flushall |
|
Clear the data of the entire redis server (delete all keys of all databases) |
Always Return OK |
Flushdb |
O (1) |
Clear all keys in the current database |
Always Return OK |
Shutdown |
|
Stop all clients |
An error is returned when execution fails. When the execution is successful, no information is returned. The connection between the server and the client is disconnected, and the client automatically exits. |
Slowlog Subcommand [Argument] |
|
Manage redis slow query logs |
|
Info [section] |
O (1) |
Returns information about the redis server. |
|
Config get Parameter |
|
Get the Configuration Parameter Value |
|
Config set Parameter value |
|
Set the configuration parameter to a specified value. |
If the setting is successful, OK is returned. Otherwise, an error is returned. |
Config resetstat |
O (1) |
Reset some statistics in the info command |
Always Return OK |
Debug object key |
O (1) |
Obtain key debugging information |
|
Debug segfault |
|
Execute an invalid memory access. This means that the redis server crashes and is only used for debugging simulation during development. |
|
Monitor |
|
Prints the commands received by the redis server in real time. |
Always Return OK |
Sync |
|
Internal commands for replication |
|
Client list |
O (N) |
Obtains the list of connections from the client to the server. |
|
Client kill ip: port |
O (N) |
Close the client with the ip Address: port |
If the specified client exists and is closed successfully, OK is returned. |
Client setname Connection-name |
O (1) |
Allocate a name for the current connection |
If the setting is successful, OK is returned. |
Client getname |
O (1) |
Return the client setname command to set the connection name |
If no name is set for the connection, a blank reply is returned; If a name is set, a name is returned. |