/
Pack Hosting Panel

Flushing Redis

How can you flush Redis?


You can flush Redis cache by the redis-cli command. As described here, it is possible when the Redis instance is set over a unix-socket as a host/port.

Below, we explain how to flush your redis cache:

Flushing all cache:

With the following command, we'll flush all cache of Redis instances that are running on host 127.0.0.1 with port 6379:

redis-cli -h localhost -p 6379 flushall

We also can flush all cache for a Redis socket:

redis-cli -s /home/<username>/domains/<domain-name>/var/run/redis.sock flushall

Flushing 1 specific database:

Now, let's flush 1 specific database of the Redis instance running on host 127.0.0.1 with port 6379:

redis-cli -h localhost -p 6379 -n 1 flushdb

At last, let's flush 1 specific database that makes use of a Redis socket:

redis-cli -s /home/<username>/domains/<domain-name>/var/run/redis.sock -n 1 flushdb