-
DBSIEZ returns the number of key-value pairs the database currently contains
18 127.0.0.1:6379 > dbsize (integer)Copy the code
-
FLUSHDB deletes all key/value pairs in the current database. The command always returns OK, indicating that the deletion is successful
127.0.0.1:6379> flushdb OK 127.0.0.1:6379> dbsize (integer) 0 Copy the code
-
FLUSHALL deletes all key-value pairs from all databases contained by the Redis service
FLUSHDB FLUSHALL The current DB All the DB -
Mysql > SELECT num from redis; mysql > SELECT num from redis; mysql > SELECT num from redis; Key-value pairs in one database have no effect on key-value pairs in another database
127.0.0.1:6379> select 1 OK 127.0.0.1:6379[1]> Copy the code
-
MOVE Key target-db Moves the key in the current database to the target database target-db. If the MOVE succeeds, 1 is returned; if the MOVE fails, 0 is returned. If the key already exists in the target database or does not exist in the current database, no operation is performed
127.0.0.1:6379> set msg hello OK 127.0.0.1:6379> move msg 1 (integer) 1 127.0.0.1:6379> move msg1 1 (integer) 0 127.0.0.1:6379> select 1 OK 127.0.0.1:6379[1]> get msg "hello" 127.0.0.1:6379[1]> get msg1 (nil) Copy the code