Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Magento to use APC cache

I just installed Magento Commerce on my hosting account and am getting fairly sluggish performance. To help speed up the site, I installed the APC cache but am having trouble getting it to work. I used these install instructions.

I followed all the steps and seemed to get APC installed. No problems. When I check APC.php, it only shows 1 hit and 1 miss to the cache, which can't be right... Making me think APC isn't active or being used.

I tried to ensure Magento uses APC by adding the following to /var/www/app/etc/local.xml.

            <cache>
                    <backend>apc</backend>
                    <prefix>alphanumeric</prefix>
            </cache>

Any help is much appreciated.

like image 582
user523513 Avatar asked Apr 19 '11 23:04

user523513


People also ask

What is APC user cache?

APC or Alternative PHP Cache, is a free open-source opcode (operation code) caching plugin for PHP. With APC caching your PHP script executions can run more efficiently, by cutting down on dynamic PHP executions.

How does Magento cache work?

Magento collects configuration from all modules, merges it, and saves the merged result to the cache. This cache also contains store-specific settings stored in the file system and database. Clean or flush this cache type after modifying configuration files.

How do I enable Magento cache?

Enable/Disable Cache Types In your Magento backend, go to System > Tools > Cache Management. Check the box on which cache type you want to enable/disable. Then on the top left corner, select the appropriate action (Enable/Disable) and click the Submit button.


1 Answers

I suggest that you use a unique string other than "alphanumeric". That way if you are sharing APC with other users or applications, your cache will be differentiated.

Have you placed the xml nodes in the correct location in local.xml? The context should be like this:

  ...
  <session_save><![CDATA[db]]></session_save>
  <cache>
    <backend>apc</backend>
    <prefix>ReplaceThisWithSomeUniqueString</prefix>
  </cache>
</global>

Also, make sure that you did a rm -rf /var/www/var/cache/* after changing local.xml.

like image 181
Jonathan Day Avatar answered Oct 06 '22 13:10

Jonathan Day