Tutorial - How to flush Redis cache and delete everything using the CLI | Vevioz Community

Tutorial How to flush Redis cache and delete everything using the CLI

DevOps

Linux Systems Engineer
Joined
Oct 18, 2019
Messages
136
Reaction score
11
Points
18
Location
Indonesia
Website
www.anymusics.com
Offline
I want a blank database and get rid of all keys. How can I delete everything in Redis cache? How do I flush my Redis cache using the Linux/Unix command line option?
You can flush cache/database and delete all keys using any one of the following command:
  1. FLUSHDB command – Delete all the keys of the currently selected DB.
  2. FLUSHALL command – Delete all the keys of all the existing databases, not just the currently selected one.
Please note that Redis version 4.0.0 and above is now able to delete keys in the background in a different thread without blocking the server. An ASYNC option was added to FLUSHALL and FLUSHDB in order to let the entire dataset or a single database to be freed asynchronously.
Warning: Once removed data/keys/values can not be recovered. Be careful when typing the following commands.
Syntax to flush Redis cache
The syntax is:

Code:
redis-cli FLUSHDB
redis-cli -n DB_NUMBER FLUSHDB
redis-cli -n DB_NUMBER FLUSHDB ASYNC
redis-cli FLUSHALL
redis-cli FLUSHALL ASYNC
redis-cli -n 4 FLUSHDB
Examples
Type the following command to delete all the keys of the DB # 4:
Code:
redis-cli -n 4 FLUSHDB
 
Last edited:

Bogdankng

New member
Joined
Jan 17, 2020
Messages
3
Reaction score
0
Points
1
Age
40
Location
Mexico
Offline
Can I contact Administration?
It is important.
Regards.
 
Top Bottom