Home » Magento Guide » Magento Security Guide » How to flush Redis cache on Magento

How to flush Redis cache on Magento

Key takeaways

  • Use Magento CLI first when you need to flush Magento-managed cache.
  • Check Redis connection details before running direct Redis commands.
  • flushdb clears one Redis database, while flushall clears all Redis databases.
  • Confirm whether Redis stores sessions before flushing cache on a live store.

Don’t let Redis clutter your Magento store’s cache. Follow our guide to flush Redis from CLI quickly and easily.

Host Magento at full throttle.

Get secure, reliable Magento hosting so you can scale faster.

Flushing Redis cache on Magento

Start with Magento’s cache tools when possible, then use Redis CLI only when you need a deeper purge or Magento commands don’t resolve the issue.

Before you flush Redis cache on Magento

Before you run direct Redis commands, confirm what Redis stores in your Magento environment. Redis may store default cache, full page cache, sessions, or data used by other applications on the same server.

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 caching and page caching on your site. If you are a Liquid Web 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.

In most Magento 2 stores, Redis settings are stored in:

Look for Redis details such as host, port, socket path, database number, and whether Redis stores cache or sessions. Dont copy a Redis command from another environment unless the database number and connection path match your store.

Method 1: flush Magento cache with Magento CLI

Magento CLI is usually the safest first option because it clears Magento-managed cache through Magento’s own cache system.

From your Magento root directory, run:

php bin/magento cache:flush

Use cache:flush when you need to clear the cache storage Magento uses.

If you only need to clear enabled Magento cache types without forcing a broader cache reset, use:

Start with cache:clean when the issue is minor or when you want to avoid a larger performance hit from a full cache flush.

Method 2: flush Redis cache with Redis CLI

Use Redis CLI when Magento commands fail, Redis memory is full, or you need to clear a specific Redis database directly.

Flush a specific Redis database

flushdb clears the selected Redis database. This is usually safer than clearing every Redis database on the instance.

Use the database number from app/etc/env.php:

You can also open Redis CLI first, select the database, then flush it:

If your environment uses a Redis socket, use the socket path from your configuration. 

Flush all Redis databases

flushall clears every Redis database on the Redis instance. Use this only when Redis is dedicated to Magento cache and does not store sessions or data for other applications.

If your environment uses a Redis socket, the command may look like this:

Some Redis versions and environments also support asynchronous flushing:

Use flushall carefully. If Redis stores live customer sessions, flushing all databases can log out active customers or affect the shopping experience.

Method 3: flush cache from the Magento Admin Panel

You can also flush cache from the Magento Admin Panel.

Go to:

System > Tools > Cache Management

Use Flush Magento Cache to clear Magento cache types. Use Flush Cache Storage only when you need to clear the underlying cache storage Magento uses.

Be careful with Flush Cache Storage if Redis shares cache storage with other applications or stores. If you aren’t sure what Redis stores, check app/etc/env.php before using a broader cache flush.

cache:clean vs. cache:flush vs. flushdb vs. flushall

CommandWhat it clearsBest forRisk level
php bin/magento cache:cleanEnabled Magento cache typesRoutine cache cleanupLower
php bin/magento cache:flushCache storage Magento usesBroader Magento cache resetMedium
redis-cli -n <db> flushdbOne selected Redis databaseTargeted Redis purgeMedium
redis-cli flushallAll Redis databases on the instanceDeep purge when Redis is dedicated to cacheHigher

When should you flush Redis cache on Magento?

You may need to flush Redis cache when storefront changes don’t appear, old layouts or blocks keep loading, cache-related errors continue after Magento cache cleaning, or Redis memory issues affect the store.

You may also flush Redis during troubleshooting after deployments, configuration changes, or full page cache issues. Avoid doing this during peak traffic unless the issue is urgent.

What to check after flushing Redis cache

After flushing Redis cache, test the storefront, key product pages, category pages, cart, and checkout.

Also monitor site performance while cache rebuilds. A cache flush can temporarily increase server load because Magento has to rebuild cached content.

When to ask for support

Ask for support before running direct Redis commands if you aren’t sure which Redis database Magento uses, whether Redis stores sessions, whether other applications share the Redis instance, or which socket path applies to your server.

Redis cache changes can affect a live store quickly, so confirm the scope before running direct commands.

Flush Redis cache FAQs

Start with Magento CLI:

If you need to flush Redis directly, check app/etc/env.php for the Redis database number, then run:

Yes, if Redis stores sessions and you clear the session database. Check Magento’s Redis configuration before running direct Redis commands.

Redis configuration is in app/etc/env.php. See the pre-configuration section above for what to look for.

Flush Redis cache next steps

Flushing Redis cache on Magento should start with Magento CLI when possible. Move to Redis CLI only after you confirm the Redis database, socket path, and cache scope.

Start by checking app/etc/env.php to confirm which Redis database Magento uses before running any direct Redis command.

If Redis cache issues affect a live store or you are unsure which Redis command is safe for your setup, explore Liquid Web Magento hosting.

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

Ready to get started?

Get the fastest, most secure Magento hosting on the market

Additional resources

How to create an admin user in Magento →

Create an admin user to manage your store securely and efficiently.

Magento shopping cart: setup, optimize, and manage →

Explore cart tools and settings that help improve the checkout experience.

Best Magento hosting providers →

Discover hosting options built for store performance, security, and growth.