Reprint: http://ju.outofmemory.cn/entry/330999
There are 3 commands for clearing data in Redis, namely: Flushall, Flushdb, SCRIPT FLUSH. Flushall [ASYNC]
Indicates that all data in all db is deleted. The default is a synchronous operation, and the option async means asynchronous, that is, the empty operation takes place in a new thread and does not block the main thread.
$ redis-cli-h 127.0.0.1-p 6379 Flushall ASYNC
flushdb [ASYNC]
Represents the deletion of all data in the current DB . The default is synchronous, which, like Flushall, supports option async, which represents async. To delete all data in the specified DB, you can use the Select command to first select DB and then use the FLUSHDB command to clear the data:
$ redis-cli-h 127.0.0.1-p 6379 SELECT 0
$ redis-cli-h 127.0.0.1-p 6379 flushdb
SCRIPT FLUSH
Indicates that all Lua script caches are deleted. All of the LUA scripts that have been executed are placed in the script cache, which forces the emptying of all Lua script caches. Refer to the EVAL command for more information on LUA scripting.
$ redis-cli-h 127.0.0.1-p 6379 SCRIPT FLUSH
ReferenceFlushall flushdb SCRIPT FLUSH EVAL
There are 3 commands for clearing data in Redis, namely: Flushall, Flushdb, SCRIPT FLUSH. Flushall [ASYNC]
Indicates that all data in all db is deleted. The default is a synchronous operation, and the option async means asynchronous, that is, the empty operation takes place in a new thread and does not block the main thread.
$ redis-cli-h 127.0.0.1-p 6379 Flushall ASYNC