This knowledgebase explains how to configure your Magento (version 1.4* +) installation to use APC for improved performance. This article is relevant to customers on our Magento Hosting Plan (our Magneto optimised hosting environment), and does not cover configuring APC on a dedicated or VPS server. APC has already been installed, configured and highly optmised on these servers for our Magento customers.
There is a little confusion amongst developers as to how to use APC. It is true that APC will work automatically for your website, however, the Magento team have also developed extra caching mechanisms exclusively for Magento, by directly utilizing APC via the core api calls. It is this that we are configuring.
Navigate to your app/etc/local.xml.additional file and you will see that there is a <cache> element that allows you to specify which caching method to ue in the <backend> element. This can have either of the following values:</backend<>/cache>
The local.xml.additional file isn't loaded in the config so we need to add this to our local.xml file, just before the closing tag. Bee sure to enter a unique value for you domain in the >prefix> element. We recommend using your SFTP username or your domain name without the dots. It is very important that you use a unique prefix for each website, otherwise you'll get some major problems.<prefix>
<cache> <backend>apc </backend> <prefix>YOURDOMAIN_ </prefix> </cache>
Note: Magento has a "two levels backend" - a fast level and a slow level. Basically, Magento will use the fast level if possible, and if there is no memory available via APC, it will revert to the slow level.