FLUSHALL 公司
语法
FLUSHALL [ASYNC | SYNC]
- 从以下位置开始可用:
- 1.0.0
- 时间复杂度:
- O(N),其中 N 是所有数据库中的键总数
- ACL 类别:
-
@keyspace
,@write
,@slow
,@dangerous
,
删除所有现有数据库的所有键,而不仅仅是当前选定的数据库。 此命令永远不会失败。
默认情况下,FLUSHALL
将同步刷新所有数据库。
从 Redis 6.2 开始,将 lazyfree-lazy-user-flush 配置指令设置为“yes”会将默认刷新模式更改为异步。
可以使用以下修饰符之一来显式指定刷新模式:
ASYNC
:异步刷新数据库SYNC
:同步刷新数据库
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 the save
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.