Categories
E-commerce Web Development

APC caching for CS-Cart 3 and Smarty 2


Today I got and email from Godaddy saying that Godaddy.com is implementing APC cache from 1st October 2012. APC cache helps your pages load a lot faster, but it is not always easy to implement it into your software. Smarty, the template engine, implements the APC cache from its version 3, but the older versions of Smarty, are a bit trickier to master.
Finding a good way of implementing APC cache to your Smarty 2 is a challenge, but don’t worry, I am here :D.
Here is a method to implement APC cache to your CS-Cart eCommerce software, which is using Smarty 2 as its templating engine:
You need to:

  1. Create a SMARTY cache handler for handling APC cache. Be careful that your APC cache handler must be compatible with SMARTY 2, as of CS-Cart 3 is concerned.Here is the APC cache handler code for Smarty 2:
    Save this code as “cache.apc.php” and place it in your Smarty’s “plugins_dir” folder. (for CS-Cart, save it in:

    <CS-Cart ROOT>/core/smarty_plugins/

    Download APC Cache handler for Smarty 2, useful for CS-Cart 3 from my Downloads page

  2. Modify the CS-Cart core files to initialize APC caching (careful with this step as it requires core modifications)For instructions about the CS-Cart modifications, please contact me.
  3. Enjoy faster loading CS-Cart store!