Two crucial Magento Admin System settings that can go overlooked if you are new to the platform are Cache Management and Index Management. Keeping up-to-date with these processes will relieve a Magento Administrator of frustration and troubleshooting. In part one of this guide we will dive further into what Caching entails and why this processes is critical for your site’s performance.
What is Cache?
Active data (data that is visible to the Magento system such as price changes on a product or a new product added to the site) on a site is stored (cached) to cut down on load time and improve performance. Browsers use their own cache for sites you frequently visit. The primary benefit to using cache is delivering faster performance. If you are unsure of why changes to your site are not populating, flushing the cache and reindexing are the first steps in the troubleshooting process.
Where to Access Cache Management
Magento 2 Cache Management is found in the Admin under System > Tools > Cache Management
Different Cache Options
Flush Cache Storage: This removes all items from the cache. Performing this action deletes the entire contents of the cache folder. If your system uses an alternate cache location, using this flush cache option ensures that files used by other applications are removed. If you are still having difficulty pinpointing why changes aren’t updating after flushing Magento cache, flushing cache storage is a more powerful option.
Flush Catalog Images Cache: This removes catalog images that are stored in media/catalog/product/cache. If recently uploaded images aren’t appearing, try flushing this cache and refreshing your browser.
Flush Static Files Cache: This removes pre-processed static and view files. “Static” means that the file is not dynamically generated and can be cached for a site, such as images and CSS. “View” refers to the presentation layer. This is typically specified by a developer who configures and deploys the files.
Full Page Caching: This feature is available in Magento 2 for both Community and Enterprise editions. This feature is quite powerful, as it allows websites to quickly serve product, category, and CMS pages to visitors of the site. Full Page Caching is critical to keeping server load as low as possible as well as avoiding down time during high traffic periods. Cart pages, account pages, and checkout pages are never cached.
In addition to flushing Magento Cache and Cache Storage, you can use the Refresh option to flush cache for individual components.
Below is a breakdown of the cache types available in the Magento system:
- Block HTML output
- Collection Data files
- Reflection Data
- Database DDL operations
- EAV types and attributes
- Page Cache
- Integrations Configuration
- Integrations API
- Customer Notification
- Web Services Configuration
- Magento collects configuration settings from all modules, merges them, and saves the merged result to the cache.
- This also contains store-specific settings stored in the file system and database.
- When to Flush: After modifying configuration files.
- These are the compiled page layouts of all layout components.
- When to Flush: After modifying layout files.
Block HTML output:
- These are HTML page fragments for each block. In Magento, the page a user sees are built from blocks and containers.
- Examples of HTML page fragments include product listings, category lists, and other links on the page.
- When to Flush: After modifying the view layer.
- These are results of Database queries. Magento cleans automatically.
- When to Flush: If a custom module uses logic that results in cache entries Magento cannot clean.
- Data Definition Language: Allows cross-database compatibility.
- The Database schema. Magento cleans automatically.
- When to Flush: If you make custom changes to the database schema.
Entity Attribute Value (EAV):
- The metadata related to EAV attributes. For example, store labels, links to related PHP code, attribute rendering, search settings, etc.
- When to Flush: Typically, do not need to clean or flush.
- These are generated HTML pages.
- When to Flush: After modifying code level that affects HTML output. Recommend keeping this cache enabled as caching HTML significantly improves performance.
- Removes a dependency between Webapi module and the Customer module.
- Merged translations from all modules.
- Magento translations allow you to customize and localize your store for multiple regions.
- Included are language packages, which enable you to translate any or all words and phrases.
- Compiled integrations. (Integrations between Magento and third party services.)
- When to Flush: After changing, or adding integrations.
Integration API configuration:
- Compiled Integration APIs.
Web Services Configuration:
- Web API structure. (Framework that allows web services to communicate with Magento.)
Why Does “Cache Invalidate” and “Reindex Required” Keep Appearing?
Simply put, this means that there are changes that have been made to your site, and the system recognizes that this changed data doesn’t match the data in the cache. Many store owners add new products daily, make changes to their pricing, update categories; these frequent updates alert the system of changes made. This, in turn, causes it to alert you that the cache is invalidated and reindexing is required, ultimately to ensure that these changes appear on your site.
If you make frequent changes or modifications to your site, you can have a web developer setup a cron job (a time-based scheduler that runs commands) to automatically flush cache and reindex your site at intervals of your choice – every 30 minutes, every 2 hours, once a day, etc.
When changes are made via the Magento Admin such as uploading new images, updating product information such as quantity and pricing, and adding or changing CMS and Static Block content, flushing various Magento caches, as well as Reindexing, are necessary steps to display the updated content on your site.
Be sure to check out part two of this guide which goes further into the steps of reindexing. If you need further assistance or have more questions about caching and reindexing on your Magento 2 site, contact us today!
About Britt Marlier
Britt is a Project Manager at Customer Paradigm. Britt is an experienced project and account manager and loves helping her clients through all aspects of their journey. Britt is skilled at holding conversations entirely consisting of movie quotes and holds the office record for most donuts eaten in a day.
View all posts by Britt | LinkedIn