Key
View all the keys in the database
Keys * // view all
Keys my * // view
Exists
Check whether a key exists. If yes, 1 is returned. If no key exists, 0 is returned.
For example:
Exists myname
Del
If a key is deleted, 1 is returned.
For example:
Del mylist
Expire
Set the expiration time of a key
For example:
Expire mylist 10 // set mylist to expire after 10 seconds
Move
Move the keys in the current database to redis. By default, there are 0-15 databases and 0 databases by default. Select numbers can be used to access other databases.
Persist
Remove the expiration time of a given key
For example:
Persist age
Randomkey
Returns a random key in the database.
For example:
Randomkey
Rename
Rename key
For example:
Rename age age_now
Type
Returns the type of the specified key.
For example:
Type mylist3
Server commands:
Ping
Test whether the connection is alive
Echo
The output is the same as that of PHP.
Select
Select a database. The redis database number ranges from 0 to 15. You can select any database for read operations.
Quit
Exit
Dbsize
Returns the number of keys in the current database.
Info
Obtain information about the redis Server
Config get
Requests received by real-time storage Transfer
Flushdb
Clear all keys in the current database
Flushall
Delete keys in all databases
Common redis commands