Command Line Interface
Below are the available commands for the Page Cache Warmer module.
Base command
bin/magento mirasvit:cache-warmer
Base command of the extension. This command requires one of the following options.
| Option | Description |
|---|---|
| --warm | warm the URLs which you can see in System -> Page Cache Warmer -> Pages depending on Performance settings and Warm rules configurations. |
| --status | re-check the collected URLs against the cache and update their Status in the Pages table. Use it when you want the statuses refreshed immediately instead of waiting for the scheduled update. |
| --reset-status | set every Cached page back to Pending so it is queued for warming again. Nothing is removed from the cache - only the stored status changes. Useful as the last step of a deployment that clears the cache. See When the cache is flushed outside Magento. |
| --remove-all-pages | remove all collected URLs from the Pages section. It is recommended to clear the cache after use so the extension can re-collect URLs. |
When to use --reset-status and when to use --remove-all-pages
In almost all cases, you need --reset-status, not --remove-all-pages.
- The cache was cleared (deployment,
redis-cli FLUSHALL, Varnish restart): use--reset-status. It keeps the collected URLs, their popularity, and their priority, and only queues them for warming again. The extension also detects most cache flushes made outside Magento by itself, so often you do not need to do anything. See When the cache is flushed outside Magento. - The URL structure of the store has changed (for example, a new domain or new URL suffixes, so most of the collected URLs no longer exist): use
--remove-all-pages. It empties themst_cache_warmer_pagetable, so the extension starts collecting URLs from scratch, and the popularity statistics collected so far are lost.
Do not truncate the mst_cache_warmer_page table as a regular maintenance step or to fix pages stuck in the Pending status. It does not make warming faster, and the warming queue is rebuilt only as visitors open pages, Sources are synchronized, or you run bin/magento mirasvit:cache-warmer:crawl.
Crawling URLs
bin/magento mirasvit:cache-warmer:crawl
Crawl store URLs and add them to the Pages table. This command can be executed as is, however it has additional options to fine-tune the execution.
| Option | Description |
|---|---|
| --unlock | unlock the synchronization process if it was finished incorrectly. |
| --customer-group-id 1 | crawl all pages for customers with the specified group ID number. |
| --cycle_limit 5 | set the crawl cycle limit (default: 100). The first cycle collects links from the Home page, and the second cycles through them. |
| --store-id 2 | crawl all pages for store with ID 2. |
| --base-url http://example.com | crawl all pages for the store with the base url http://example.com |
| --ignore-query | crawl all pages except pages with query parameters (?). |
Command options can be combined:
bin/magento mirasvit:cache-warmer:crawl --ignore-query --unlock
Synchronize URLs from source
bin/magento mirasvit:cache-warmer:sync-source
Synchronize URLs from configured Sources. This command has the following options:
| Option | Description |
|---|---|
| --source-id 2 | synchronize the source with ID 2. |
| --reset | reset synchronization date of the Source(s). It will not start the synchronization automatically after resetting the synchronization date. |
| --unlock | unlock if it was finished incorrectly. |
Command options can be combined:
bin/magento mirasvit:cache-warmer:sync-source --source-id 2 --unlock --reset
Simulating cron tasks
bin/magento mirasvit:cache-warmer:cron
Running all extension cron tasks once to verify the module's functionality.
Testing
bin/magento mirasvit:cache-warmer:test
This command is for the testing purposes.