What is cache
Today we will consider the issue Cache in Magento 2, why this function is needed and how we can manage it.
This article is for people, who manage the site from admin panels CMS, and for developers, who use the command line – terminal.
So, what is Cache, and why it needs us?
Cache – is pages (or parts of pages) that are stored to improve the page load time of subsequent requests.
It is needed for adding speed render/load site.
Let’s start the practical part of this article!
We will start manage cache from CMS admin panel and we will consider it from the terminal.
CMS admin panels
‘System -> Cache management”
Here is the place for cache management on our site.
#1 – Choose all confirmation or specific. Also, under #1, you can select the checkbox for individual changes.
#2 – Here there are the following options: refresh, enabled and disabled.
#3 – Button for submitting of our changes
This screenshot shows us how we can choose some type of configuration and what action we used, we can see it in the column ‘Status’.
Also, let’s investigate the difference between buttons:
“Flush Magento Cache” – 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.
“Flush Cache Storage” – Flushing a cache type purges the cache storage, which might affect other processes applications that are using the same storage.
Command line for terminal users
php bin/magento cache:status – check status of the cache
php bin/magento cache:clean – clear cache
php bin/magento cache:flush – flush cache
php bin/magento cache:disable – disabled cache
php bin/magento cache:disable CACHE_TYPE – structure disabled
For example :
php bin/magento cache:disable full_page
php bin/magento cache:enable – enable cache
php bin/magento cache:enable CACHE_TYPE – structure enableed