Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Flushdb Command

Redis Flushdb Command

Redis Server

The Redis Flushdb command is used to clear all keys in the current database.

Syntax

The basic syntax of the redis Flushdb command is as follows:



redis 127.0.0.1:6379> FLUSHDB 

Available Version

= 1.0.0

Return Value

Always returns OK.

Example



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