Magento cache overview
Caching is one of the most effective way of improving performance of web applications of all kinds. Generally speaking, there are two ways to cache: client-side (browser) and server-side. In addition, there are two types of content: public (available to multiple customers) and private (specific to one customer).
Magento page caching is synonymous with full-page caching; in other words, we cache the entire page. The Magento application gives you the following options:
The default caching mechanism which stores cache files in any of the following:
Cacheable and uncacheable pages
Cacheable and uncacheable are terms we use to indicate whether or not a page should be cached at all. (By default, all pages are cacheable.) If any block in a layout is designated as uncacheable, the entire page is uncacheable.
To create an uncacheable page, mark any block on that page as uncacheable in the layout using
Examples of uncacheable pages include the compare products, cart, checkout pages, and so on.
Do not configure content pages (that is, catalog, product and CMS pages) to be uncacheable. Doing so has an adverse affect on performance.
The following cache types mostly have impact on frontend development process:
|Cache type “friendly” name||Cache type code name||Description|
||Compiled page layouts (that is, the layout components from all components). Clean or flush this cache type after modifying layout files.|
|Block HTML output||
||HTML page fragments per block. Clean or flush this cache type after modifying the view layer.|
||Generated HTML pages. If necessary, Magento cleans up this cache automatically, but third-party developers can put any data in any segment of the cache. Clean or flush this cache type after modifying code level that affects HTML output. It’s recommended to keep this cache enabled because caching HTML improves performance significantly.|
||Merged translations from all modules.|
The full list of cache types can be found in the Overview of cache types topic.
To clean cache, run
magento cache:clean <type> ... <type>
To view the status of the cache, run:
`php bin/magento cache:status`
For more details about working with cache, see Manage the cache
Clean static files
Besides the cached files, inn theme development process developers also deal with other saved files - static view files that are preprocessed and published to the
pub/static directories correspondingly. In most cases when working on a custom theme, for example, if you are only working on styles, you do not need to clean cache, but need to clean the previously preprocessed and published static view files. To clean them, run
grunt clean <theme> or manually clear the