How to clear Redis from CLI in Magento

    September 7, 2021

    Redis is commonly used on Magento stores for object caching and page caching.


    To be able to clear Redis from CLI, you will need to make sure that SSH is enabled if you have your Magento store on a non-cloud server. If you have a Magento cloud server, then you can find the SSH credentials from the portal of your site.


    CAUTION: Use caution when performing this operation since data will be cleared related to object and page caching on your site. If you are a Nexcess client, we recommend discussing other options with our support team before flushing your Redis database. You may contact them by email or through your Client Portal.


    Identify the Redis connection details in the configuration file of your Magento store. If you need help locating this file, then please contact our support team.


    Flush your cache using one of the below commands, but replace the angled brackets (<>) and everything between them with the indicated information that has been provided by support. If the first path is invalid, try the second. The correct path depends on your server type and various other factors.

    Flush your cache using one of the below commands, but replace the angled brackets (<>) and everything between them with the indicated information. If the first path is invalid, try the second. The correct path depends on your server type and various other factors.

    redis-cli -s /var/tmp/redis-multi_<customer_specific_name>_cache.sock flushall


    redis-cli -s /var/tmp/redis-multi_<customer_specific_name>_cache.sock flushall async


    redis-cli -s /var/tmp/redis-multi_<customer_specific_name>_cache.sock -n <db number> flushdb


    redis-cli -s /var/tmp/redis-multi_<customer_specific_name>_cache.sock -n <db number> flushdb async


    The Redis CLI will make clearing the Redis caching on your Magento store fast.

    For 24-hour assistance any day of the year, contact our support team by email or through your Client Portal.

    Was this article helpful?

    Send feedback

    Can’t find what you’re looking for?

    Our award-winning customer care team is here for you.

    Contact Support