FLUSHDB

Since 1.1.0ServerChanged in 1.2.1

Syntax

FLUSHDB
  • Flags: write
  • ACL categories: @dangerous, @slow, @write
  • Arity: -1

History

  • 1.2.1: acl categories: removed server

Deletes every key of the current database, the one chosen with SELECT, and leaves the other databases as they are. It cannot be undone, and it is replicated like any write.

  • SYNC frees the memory before replying.
  • ASYNC replies at once and frees large values on a background thread, as described in Memory.
  • Without either, it frees at once, as with SYNC. lazyfree-lazy-user-flush is accepted and changes nothing.

Anything but ASYNC or SYNC is refused with ERR syntax error, as in Redis, since 1.2.1. 1.2.0 took any other word as SYNC, and flushed. FLUSHALL deletes every database's keys.

Reply

OK.

Examples

> SELECT 1
OK
> SET k v
OK
> SELECT 0
OK
> SET a 1
OK
> FLUSHDB ASYNC
OK
> DBSIZE
(integer) 0
> SELECT 1
OK
> DBSIZE
(integer) 1