LiteMage Cache, developed specifically for Magento by LiteSpeed Technologies, is the world's fastest Magento full page cache. Making effective use of server-side caching and ESI (Edge Side Includes) hole punching, LiteMage Cache speeds up both static and dynamic pages in order to deliver superior performance and responsiveness for any Magento website. This tutorial guides you through all the steps needed to enable and configure LiteMage Cache.
The following prerequisites must be installed before LiteMage Cache can be enabled. ProperHost servers already meet these requirements. Clients can skip to "Installation Step-by-Step".
* Varnish and other caches should be disabled
It is necessary to specify a path that LiteMage can use to store its cached files. This can be set at the server level in the Cache settings of LiteSpeed, or for each virtual host if you are hosting multiple Magento stores on the same server. Add the below code to the vhost config for your web server. It is recommended to choose a fast disk such as a RAMDISK or SSD for maximum performance.
<IfModule LiteSpeed>
CacheRoot /path/to/litemage/cache/dir
</IfModule>
ProperHost clients will find their cache root placed under the directory /home/<user>/litemage_cache.
The process to enable LiteMage for a Magento site consists of the following steps, each of which we will go through in detail.
Add the below code to the .htaccess file under the root directory of each of your Magento installations to enable the LiteMage module.
<IfModule LiteSpeed>
LiteMage on
</IfModule>
LiteMage includes an extension which is used to configure and control the cache from within Magento. Start by downloading the latest version of the LiteMage extension package, then follow these steps to install the package via Magento Connect:
Congratulations! LiteMage Cache should now be installed and activated for your Magento website.
To verify that the cache is working, navigate to your Magento website (e.g. a product page) and hit refresh a few times to allow the cache to build up. If LiteMage is working you should see the header "X-LiteSpeed-Cache:hit,litemage" added to the response. See the screenshot below for an example from Google Chrome browser.
For initial deployment and development you can run LiteMage in testing mode. Under LiteMage Cache Configuration in the Admin Panel, add your IP address to Enable LiteMage Cache Only for Listed IPs. Remove your IP when you are done with your testing to turn on caching for all users.
Once LiteMage Cache is enabled, a "Flush LiteMage Cache" button will show up under System / Cache Management. If you click "Flush Magento Cache" or "Flush Cache Storage", it will automatically flush LiteMage Cache.
If you encounter a "Your installation of LiteSpeed Web Server does not have LiteMage enabled." error, make sure that you have enabled LiteMage in your Magento .htaccess file (see the Enable the LiteMage module step above).
LiteMage defines a number of ESI blocks for sections of a page that should not be cached (also known as hole punching). To highlight the punched holes on a specific page, simply add ?LITEMAGE_DEBUG=SHOWHOLES to the end of the page URL. This can be useful for debugging.
Magento includes a built-in cronjob to crawl the site and warm up the full page cache. To enable LiteMage cache warmup, go to System / Configuration / LiteMage Configuration / Cache Warmup and set Enable Cache Warmup to "Yes". The Magento cron job must also be set up correctly for the cache warmup to work.
Although LiteMage has been configured out of the box to work with the majority of Magento websites, some heavily customized sites might still need additional configuration to work 100%. For example you can add additional ESI blocks to create custom non-cachable blocks. In order to do this you must edit the LiteMage configuration file: app/code/community/Litespeed/Litemage/etc/config.xml. Please note that this requires advanced knowledge of the Magento module system and templating engine, so please consult a developer for assistance. ProperHost does not offer help with customization of this file.
Please consult the official documentation for further information.