FLUSHALL
Syntax
FLUSHALL [ASYNC | SYNC]
- Available since:
- 1.0.0
- Time complexity:
- O(N) where N is the total number of keys in all databases
- ACL categories:
-
@keyspace
,@write
,@slow
,@dangerous
,
Delete all the keys of all the existing databases, not just the currently selected one. This command never fails.
By default, FLUSHALL
will synchronously flush all the databases.
Starting with Redis 6.2, setting the lazyfree-lazy-user-flush configuration directive to "yes" changes the default flush mode to asynchronous.
It is possible to use one of the following modifiers to dictate the flushing mode explicitly:
ASYNC
: flushes the databases asynchronouslySYNC
: flushes the databases synchronously
Notes
- An asynchronous
FLUSHALL
command only deletes keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected. - This command does not delete functions.
- Other than emptying all databases (similar to
FLUSHDB
), this command clears the RDB persistence file, aborts any snapshot that is in progress, and, if thesave
config is enabled, saves an empty RDB file.
Behavior change history
>= 6.2.0
: Default flush behavior now configurable by the lazyfree-lazy-user-flush configuration directive.
RESP2/RESP3 Reply
Simple string reply:OK
.
History
- Starting with Redis version 4.0.0: Added the
ASYNC
flushing mode modifier. - Starting with Redis version 6.2.0: Added the
SYNC
flushing mode modifier.