How to Flush Redis Databases and Keys?

Redis has grown to become one of the most popular NoSQL database systems (not to mention cache systems) in use today. Perhaps the biggest advantage Redis has over other NoSQL systems is that runs almost entirely in memory.

In Redis Official Documentation deleting refers to flushing. Flushing means removing or deleting any data. There are two types of flushing methods.

  • FLUSHDB – Flushes/Deletes a Single Database Keys
  • FLUSHALL – Flushes/Deletes all the databases on Redis Server

 

We will tell you commands for both the flushing methods. Kindly proceed the following guide

 

Deleting all keys from current selected Database

redis-cli FLUSHDB

 

Deleting all keys from a specific Database

redis-cli -n 5 FLUSHDB

Here,

 ‘5’  is the database number you want to delete/flush

 

Deleting all the databases from Redis Server

redis-cli FLUSHALL

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)