Description
Delete all the keys in the currently selected database. This command never fails.Method Signature
Parameters
Optional configuration object:
Return Value
Always returns
"OK"Examples
Flush database synchronously
Flush database asynchronously
Clear test data
Safe flush with confirmation
Check size before and after
Async vs Sync
Synchronous (default)
- Blocks the server until all keys are deleted
- Suitable for small databases
- Guarantees database is empty when command returns
Asynchronous
- Returns immediately
- Deletion happens in background
- Suitable for large databases
- Doesn’t block other operations