====== LSCache + Magento ======
**Note: This page describes an easy way to set up simple caching for Magento installations. With the release of [[http://www.litespeedtech.com/products/litemage-cache|LiteMage Cache]], though, this solution is now deprecated. Click [[litespeed_wiki:cache:litemage|here]] for the LiteMage Cache installation and configuration manual.**
===== Summary =====
It is rather simple to have LSCache and Magento work together. LSWS enables private cache and defines URL pattern not to be cached.
===== Procedures =====
Here are the steps that will enable LSWS to work with Mangento:
==== Set up Cache Policy ====
In LiteSpeed (v4.1.2 or later) Admin CP -> Configuration -> Server -> Cache
Storage Path: /diskcache
Max Object Size: 128K
Cache Policy
Enable Cache: No
Cache Expire Time (seconds): Not Set
Cache Request with Query String: No
Cache Request with Cookie: No
Cache Response with Cookie: No
Ignore Request Cache-Control: No
Ignore Response Cache-Control: No
Enable Private Cache: Yes
Private Cache Expire Time (seconds): 60
Do-Not-Cache URL(s):
/checkout/
/admin
/customer
/downloader
**Note:**
- Do-Not-Cache URL box holds all of the URL(s) that should **NOT** be cached.
- Cache storage can be set to /dev/shm/diskcache to avoid disk I/O wait if enough memory can be spared.
- Cache resource with size less than 128KB.
- For cached request, "X-LiteSpeed-Cache: private,hit" response header should be seen. IOW, if no such entry in the response header, the response is not cached by LSWS.
=== Crate a cronjob to clean up stale cache ====
*/10 * * * * find /diskcache -type f -mmin +10 –delete
**Note:** This cron job clean up stale cache storage every 10 minutes.
==== Add entries to /etc/rc.local ====
echo "mkdir /diskcache && chmod nobody.lsadm" >> /etc/rc.local
echo "/diskcache && chmod 770 /diskcache" >> /etc/rc.local
**Note:** this is to make sure cache directory gets created when server is booted up.