When you have added or modified XML, CSS or JS files.
In Magento, you typically need to clear the cache to see the changes made when you have modified any code, such as layout XML files, templates, or configuration files. This ensures that the changes are reflected accurately on the storefront.
There are several methods to clear the cache in Magento:
- Admin Panel: You can clear the cache from the Magento Admin Panel by navigating to System > Cache Management, selecting the cache types you want to clear, and clicking on the “Flush Magento Cache” button.
- Command Line: You can use command-line interface (CLI) commands to clear the cache. For instance, you can use the
bin/magento cache:clean
command to clean the cache. - File System: If you have direct access to the file system, you can manually delete the contents of the
var/cache
directory. However, this method is less preferred compared to using the Admin Panel or CLI commands.
It’s essential to clear the cache after making changes to ensure that the latest modifications are reflected on the storefront, especially in a production environment where caching is enabled for performance optimization.