Clear Redis Cache Example

In this tutorial we will show you many ways you can delete these key-values (keys) and clear the Redis cache. Redis is an open-source solution for data structure storage. It is primarily used as a key-value store, which allows it to work as a database, cache storage, and message broker.

How to Clear Redis Cache

The easiest way to clear Redis cache is to use the redis-cli command. The redis-cli command uses the following syntax:

redis-cli [database number] [option]


Delete All Keys in Redis Cache

redis-cli flushall

Deleting Keys from a Specific Database

redis-cli flushdb

Using the flushdb command without any parameters clears the currently selected database. Use the -n parameter with the database number to select a specific database you want to clear:

redis-cli -n [database number] flushdb

You can also use the async option when clearing keys from individual databases:

redis-cli -n [database number] flushdb async

Wagiman Wiryosukiro

Petani Sistem Informasi, tukang las plugin & themes Wordpress. Co-Founder Saat ini aktif sebagai Developer & kontributor di OpenMandriva Linux.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: