Jump to content
sors

[Core Extension] APC Caching class

Recommended Posts

This class takes advantage of APC extension for caching data (like memcached option).

Upload CacheAPC.php to classes directory. In config/settings.inc.php set '_PS_CACHING_SYSTEM_' to 'CacheAPC'

define('_PS_CACHING_SYSTEM_', 'CacheAPC');
define('_PS_CACHE_ENABLED_', '1');

CacheAPC.php

  • Like 2

Share this post


Link to post
Share on other sites

Thank you, I really am interested in speeding PS up but can you provide a little more info about this class ? Did you make any test to see the improvements ? I'd very curious to see some results.

Share this post


Link to post
Share on other sites

PrestaShop 1.4.2.5, PHP 5.3.5, Windows

Without caching and APC - 953 ms
Without caching and with APC - 625 ms
File system cahe and APC - 703 ms
Memcache with APC - 578 ms
APC caching - 562 ms

Share this post


Link to post
Share on other sites

sors, thank you very much; reading the above, I understand that using the APC caching and PS caching is the best option since the 562 ms is the best result. What would you advise ?

Share this post


Link to post
Share on other sites

I did the change in settings.inc but don't I have to do anything in BO/Preferences/Performance ? Caching is deactivated because I have only the Memcache and Filesystem options. Smarty cache is active.

Share this post


Link to post
Share on other sites

Difference between APC and memcache is not very big. If on server installed APC - use APC caching, if APC not installed try memcache+eAccelerator

Share this post


Link to post
Share on other sites

change

define('_PS_CACHE_ENABLED_', '1');

Share this post


Link to post
Share on other sites

Thanks, now I have to wait my hosting reply, if they have APC enabled.

Share this post


Link to post
Share on other sites

I just tried to enable APC on my site however once I set the enabled to "1" my site will not load it gives me a HTTP Error 500 (Internal Server Error

Any idea why this would happen? and How to fix so I can use APC since I cannot use the standard two methods of caching.

 

I have pasted what my code shows in config/settings.inc.php

 

I am running version 1.4.6.2 of Prestashop

 

 

 

define('__PS_BASE_URI__', '/');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_PS_CACHING_SYSTEM_', 'CacheAPC');

define('_PS_CACHE_ENABLED_', '0');

 

 

My sincere thanks to anyone who can help!!

Share this post


Link to post
Share on other sites

Nice one !

 

I have installed this on my www.prestadget.com

 

Check this out, really fast

 

And only 1 place to monitor both APC code cache and prestashop cache !

 

Need to remove parent::__destruct() for prestashop > 1.4

  • Like 1

Share this post


Link to post
Share on other sites

I just tried it and indeed it is super fast but i can't add products to the cart it gives following error

 

 

TECHNICAL ERROR: unable to add the product.

Details:

Error thrown: [object XMLHttpRequest]

Text status: error

 

Also not possible to delete products in cart: ERROR: unable to delete the product

 

My Prestashop version 1.4.7.3

 

Any idea why?

Share this post


Link to post
Share on other sites

Anyone who can help me out with this one?

Share this post


Link to post
Share on other sites

I run APC Cache on 1.4.7 and it's 1second slower then eAccelerator and Memcache. Out of all the pain of setting the stuff up I've come to the conclusion that APC is not the faster option for 1.4.7.0. I've downloaded the php class and followed instrcutions. My VPS is 8gig with 5 CPU;s... I know.. a little over the top.

 

I'm also running FastCGI - so I think that's the reason why APC is not working. So far. The best setup for me to get 10 requests per second running this command:

 

ab -n 100 -c 10 -H "Accept-Encoding: gzip;" http://www.iconhomeware.com.au/

 

I'm still working through the actual best options still

Share this post


Link to post
Share on other sites

@chetwyn same here APC caching is not working also a error when use the modification as above

i have no idea to solve this ...

Share this post


Link to post
Share on other sites

Hello,

 

I post this message because I have the APC cache enabled on my server but I can't activate it on Prestashop !

As soon as I change the setting.inc file, I have a blank page when loading the site.

 

How to do ?

 

My web site for information : www.1art1design.com

Thanks,

David

Share this post


Link to post
Share on other sites

PrestaShop 1.4.2.5, PHP 5.3.5, Windows

 

Without caching and APC - 953 ms

Without caching and with APC - 625 ms

File system cahe and APC - 703 ms

Memcache with APC - 578 ms

APC caching - 562 ms

okay , I have added the class to my calsses folder , and APC is now enabled but where do i the stats which you are showing 

Share this post


Link to post
Share on other sites

Hi!

 

I have APC installed on my server yet when I try to turn it on at Advanced Parameters  > Performance

PS 1.5.6.1 just gives "The CacheFS system should be used only when the infrastructure contains one front-end server. If you are not sure, ask your hosting company." and in a field below it is "1" indicated.

 

Does that mean that APC activated already? How can I check it? My site still loads within 6s, which is a lot.

 

Any advise?

 

Thanks a lot!!!

Share this post


Link to post
Share on other sites

Hi All , 

 

I am getting following error after putting CacheAPC.php file in /classes folder and changing "_PS_CACHING_SYSTEM_" to  "CacheAPC"  and  '_PS_CACHE_ENABLED_' to '1'

 

Fatal error: Class CacheAPCCore contains 5 abstract methods and must therefore be declared abstract or implement the remaining methods (CacheCore::_set, CacheCore::_get, CacheCore::_exists, ...) in /var/www/html/classes/CacheAPC.php

 

I am using

prestashop 1.5.6.1

PHP 5.5.21

APC support  - Emulated

APCu version 4.0.7

 

Please help me resolve the error 

Share this post


Link to post
Share on other sites

Hi, I have a problem :(

 

PHP Fatal error: Call to undefined method Cache::__destruct() in /var/www/my_vps/data/www/tiande4life.com.ua/classes/CacheAPC.php on line 98

 

Prestashop 1.4.9.0 - VDS SSD Server - Debian amd64- PHP as an Apache module

 

Help me please!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More