There are some scenarios in which the Litemage cache won’t be working on the Magento 2 website. Let’s discuss how to troubleshoot if the Litemage caching is not working on the website.
Solution
- Make sure that LiteMage cache is installed and enabled from the admin panel.
- Make sure that the Magento cronjobs are running fine. You can ensure this by checking the `cron_schedule` table of the database used by the website. Check if the status is “SUCCESS”.
- If the above checks fail, we can manually crawl the website contents as shown below.
The crawler travels through your site, refreshing pages that have expired in the cache. This makes it less likely that your visitors will encounter un-cached pages.
Before we start, make sure that crawler is enabled on the server. If not you can read more on enabling the crawlers here.
Enable Sitemap on the Magento store
Navigate to Magento Admin > Stores > Settings > Configuration > Catalog > XML Sitemap
Set Generation Settings > Enabled to yes
Configuring a Single Sitemap for All Storefronts
Navigate to Magento Admin > Marketing > Seo & Search > Sitemap
- Click the Add Sitemap button
- Enter values
- Filename: sitemap.xml
- Path: /
Click the Save & Generate button
If all went well, a sitemap.xml file will have been generated in your Magento 2 document root.
Once the sitemap.xml is generated download the Litemage crawler script from here.
Change the permissions so that the file is executable:
chmod +x M2_crawler.sh
Run the script: bash M2-crawler.sh SITE-MAP-URL
For example, if the URL is sagemagento.com then the command will be like:-
bash M2-crawler.sh sagemagento.com/sitemap.xml
How to verify if the crawlers are working
- If the crawlers are working perfectly, when you curl the website you will be able to see X-LiteSpeed-Cache: hit,litemage in the curl output.
- When using the browser developer tool, load a previously uncached page. You should see X-LiteSpeed-Cache: hit,litemage on the first view.