Differences
This shows you the differences between two versions of the page.
— |
archive:lscache_magento [2015/10/23 21:15] (current) Michael Alegre created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 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 | ||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | Do-Not-Cache URL(s): | ||
+ | <code> | ||
+ | /checkout/ | ||
+ | /admin | ||
+ | /customer | ||
+ | /downloader | ||
+ | </code> | ||
+ | **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 ==== | ||
+ | |||
+ | <code> | ||
+ | */10 * * * * find /diskcache -type f -mmin +10 –delete | ||
+ | </code> | ||
+ | |||
+ | **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. |