Magento 2 Cache Warmer Documentation
-
Installation
You can install the module for Magento 2 using Composer or you can manually install it using FTP.
ComposerManualRun the following commands in your Magento 2 root directory to install the module using Composer.
# Add the FishPig Composer repo composer config repositories.fishpig composer https://repo.fishpig.com/ # Install the module using Composer composer require fishpig/magento2-cachewarmer:* # Enable the module in Magento 2 php bin/magento module:enable FishPig_CacheWarmer # Run the Magento upgrade system php bin/magento setup:upgrade
You can download the latest version of the module by logging in to your account and selecting Account > Projects.
Extract the ZIP file and upload the files to your Magento site at the directory below:
When creating the folders, ensure you use the correct capitalisation.
To complete the installation, run the following commands in a terminal.
# Enable the module in Magento 2 bin/magento module:enable FishPig_CacheWarmer # Run the Magento upgrade system bin/magento setup:upgrade
-
CLI Commands
The Cache Warmer is a command line based on module. This means that to run the module, you will need to have SSH access to your server.
The command below can be executed directly or can be added to your CRON job.
bin/magento fishpig:cachewarmer --file pub/sitemap.xml --store 1
You must specify the --file and --store parameters for this to work.
-
Smart Warming
The Cache Warmer uses our Smart Warming technology to provide real time access to cache contents to determine whether or not a URL is already cached. This allows it to make real time decisions on whether or not to warm a URL and allows it to achieve extremely fast speeds and high rates of efficiency.
Why Smart Warming?
Standard Magento 2 Cache Warmers warm all URLs provided and more often than not, most of these URLs are already warm (ie. in the cache). This wastes time and computer resources. It also that means for very large lists of URLs, you never end up warming them all (because you waste time warming URLs that are already warm).
Enabling Smart Warming
Smart Warming requires that our Magento 2 full page cache module is installed. This module fully integrates into the Cache Warmer to provide real time updates on cache contents and changes and allows the Cache Warmer to make upto date decisions on when and what to warm.
If you have both the Cache Warmer and our FPC module installed then Smart Warming will enable automatically.
If you're having problems, try upgrading the FPC and Cache Warmer to the latest version and see if that solves your issue.
Efficient Warming
With Smart Warming enabled, you can run the warmer as often as you like. Any URLs already warmed will be skipped over and only URLs not currently cached will be warmed. Without Smart Warming, regularly running a cache warmer would consume valuable server resources, which should be reserved for paying customers.
Warming a Large Number of URLs
Processing a large number of URLs is easy using the Cache Warmer and Smart Warming. Simply run the Cache Warmer and leave it to run. If for any reason it stops or you manually stop it, you can re-run it and all URLs already processed will be skipped.