Latest web development tutorials

Redis Flushdb command

Redis server

Redis Flushdb command is used to clear the current database of all key.

grammar

redis Flushdb basic command syntax is as follows:

redis 127.0.0.1:6379> FLUSHDB 

Available versions

> = 1.0.0

return value

Always returns OK.

Examples

redis 127.0.0.1:6379> DBSIZE    # 清空前的 key 数量
(integer) 4

redis 127.0.0.1:6379> FLUSHDB
OK

redis 127.0.0.1:6379> DBSIZE    # 清空后的 key 数量
(integer) 0

Redis server