Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Magento 2 we have 2 commands

php bin/magento cache:flush
php bin/magento cache:clean

What's exact difference between them? I'm generally using cache:flush. I never used cache:clean. So, when to use which command & in which situation?

share|improve this question
up vote 2 down vote accepted

To purge out-of-date items from the cache, you can clean or flush cache types:

Cleaning a cache type deletes all items from enabled Magento cache types only. In other words, this option does not affect other processes or applications because it cleans only the cache that Magento uses.

Disabled cache types are not cleaned.

Flushing a cache type purges the cache storage, which might affect other processes applications that are using the same storage.

Flush cache types if you’ve already tried cleaning the cache and you’re still having issues that you cannot isolate.

share|improve this answer

php bin/magento cache:flush

Removes all items in the default Magento cache (var/cache) and the var/full_page cache that have a Magento tag.

php bin/magento cache:clean

This command removes all items in the cache. This is the equivalent of deleting the entire contents of the cache folder on the server.If your system uses an alternate cache location, any cached files used by other applications will be removed.

share|improve this answer
    
Thanks @Rafael. So which is best & when to use? – Ankit Shah Sep 27 '16 at 1:49
    
Depends, but I prefer cache:clear – Rafael Corrêa Gomes Sep 27 '16 at 1:59

Using bin/magento cache:clean you can specify(comma-separated) cache types you want to clean.

Supported types:

config, layout, block_html, collections, reflection, db_ddl, eav,
customer_notification, target_rule, full_page, config_integration,
config_integration_api, translate, config_webservice
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.