Menu

Express Cache 3

Express Cache is a Prestashop module which accelerates your web shop upto 5x times faster.

Once a page has been accessed by any user, Express Cache saves the output on filesystem and mark that page as a “cached” page. Next time, if any user requests the same page, “cached” version of the same page will be served by the module.

Features

  • Beautiful cache stats – Time saved, cache space used, cache hits.
  • Live Cache Editor – Stats, force refresh cache for a particular page.
  • Compression of cache files
  • Dynamic Hooks – Live page components for cached pages
  • Whitelisting of pages to be cached
  • Triggers – Refresh cache based on specific events, for example – Product updation etc
  • Specify cache timeout, cache limit, clear cache.
  • View per page stats, cache hits/miss, clear stats
  • Much more…

Installation

  • To install the module, just navigate to Modules and Service > Module.
  • Then upload the module by clicking on Add Module.
  • Once the module is uploaded, click on “Install” to install this module.
  • To view settings go to “Configuration” page of the module.

Express Cache creates a table “ps_express_cache” to track all the cache entries along with stats.

If you are getting error during installation of the module, or if you have a incomplete uninstall and the module fails to install again, visit the Troubleshooting section.

Configuration

Basic

  • Cache timeout – Default – 60 mins. After a timeout is expired for a page, cache entry for that page will be refreshed when accessed by a user.
  • Live Cache Editor – View and manage cache entry for any page on the front office. If set to Visible to Current Employee, it shows the cache editor in front office until you are logged onto the backoffice i.e only to current employee. If set to Visible to All, it shows the cached editor to everyone (not recommended for production environment).
  • Compress Cache – Cache entries are saved in filesystem under modules/expresscache/cache folder. If this option is set to Yes, all cache files will be saved in compressed (gzip) format to save space. Disabling this does increase performance a bit, but its set to “Enabled” by default to save space. If space is not a big concern, you can disable this setting. Make sure to clear the cache if you make any changes to this setting.
  • Skip caching for logged in users – If enabled, the module will not serve cache pages to logged in users in the front office. This setting is related to the Dynamic Hooks section. If the dynamic hook for module “blockuserinfo” is enabled properly, then you can leave this setting as disabled. Read Dynamic Hooks section to know more about this.
  • What to cache? – You can specify which sections in the front office should be cached. For example – specifying “category” here will cache all products in the category listings. If your shop has a dynamic page which you don’t want to be cached, you can exclude that page in the setting’s textbox.

Tip: Make sure to clear cache after you make any changes to this section.

Dynamic Modules

This setting can be little difficult to understand at first, but its the most important and easiest one once you get the concept.

Concept – As explained in the beginning, when a page (or URL) is accessed first time by user, Express Cache saves the output in a file. This output or “cache” is then served to subsequent requests to that page (or URL) accessed by any user (not just the original user). However, if the page contains some dynamic elements which needs to be different for various users based on many parameters, above methodology no longer results in valid output. Hence the concept of “Dynamic Modules”.

In this section, you can tell the Express Cache about which modules are dynamic no matter if a page is cached or not. So, even if there is a cache file for a page, the “dynamic modules” for that page will be run internally and it will be refreshed with dynamic content.

For example, the module “blockuserinfo” shows if a current user has logged in or not on every page. So its essential to run this module everytime a page is accessed, even if its cached already and refresh the content of output with the results we got from this module. So, we enable the hooks which should be called for this particular module.

When you first install Express Cache, it will try to enable few Dynamic Modules automatically, like “blockuserinfo” and “blockedviewed”.

How to determine which module should be dynamic

If a particular module shows different content for different users or basically produces dynamic content, it should be configured as dynamic module. You should enable the particular “hook” which is resulting in dynamic content output.

If you are having issues in identifying the dynamic modules for your shop, please contact support.

Triggers

This setting is straight forward. This section contains various “triggers”, which when triggered clear certain cache files based on the outcome of that trigger. For example, “Refresh Cache on Product Updation” – if a product is updated or deleted in the backend, the cache of this product should be refreshed. Also, “Refresh Cache for Linked Categories” will refresh cache for all the corresponding categories linked to this product.

Storage

You can specify the maximum storage that will be used to store the cache, once the space used has gone beyond this setting (0 = no limit), the module will automatically delete the oldest cache entry and store the latest one.

Stats

In this section, you can view the stats for all the cached pages so far, you can also “Refresh” or “Clear” stats.

One important information provided here is the “Hits” and “Miss” stats per page. “Miss” is the count of page accesses when the cache wasn’t present or had expired already. “Hits” is the count of page accesses when the cache was present for that page and was served to the user.

Tip: Your total “Cache hits %” (shown on the top of the module config) is lower than 30%. You should increase your cache timeout.

Troubleshooting

Q. You get the following error during install.

Unable to install override: The method smartyOutputContent in the class FrontController is already overridden.

(Even if you have same error but different method or different class, following this answer).

A. There are two possibilities:

1. You have previously uninstalled this module and for some reason it wasn’t uninstalled properly. In this case, delete the following functions from the following override files (functions/lines to be deleted are marked accordingly).

[override/classes/controller/Controller.php]

abstract class Controller extends ControllerCore
{
	//Remove this line
	public $express_start_time;

	//Remove this function.
	public function run() {
		[ .. ]
	}
}

[override/classes/controller/FrontController.php]

class FrontController extends FrontControllerCore
{

	//Remove this function.
	protected function smartyOutputContent($content) {
		[ .. ]
	}
}

[override/classes/Hook.php]

class Hook extends HookCore
{

	//Remove this function.
	public static function getNameById($hook_id)
	{
		[ .. ]
	}


	//Remove this function.
	public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true, $use_push = false, $id_shop = null)
	{
		[ .. ]
	}
}

After clearing the above files, follow the installation of the module.

2. You have another module (from a different vendor) with conflicting overrides.

This is rare scenario. In this case, work with other module vendor to see if they can use any other overrides for their functions. If nothing works out, you are eligible for a refund, please raise a request from the purchase history at xtendify.com.

Q. You are getting ‘0’ cache values even after several page refresh.

Possibility #1 – You have overrides disabled.

Check in Advance Parameter > Performance. You should see the following setting.

Both “Disable non Prestashop modules” and “Disable all overrides” should be in “Disabled” state (as shown).

Possibility #2 – Incomplete UnInstall.

Sometimes its just a case of incomplete install. Just try to uninstall and install again. This solves the problem 50% of the time.

Mobile

Express Cache uses the same settings specified in your Prestashop theme configuration about how to handle mobile devices. For example, if you are showing mobile theme on smartphones only, Express Cache will cache two copies of the same page one for the smartphones and another for other devices.

You can disable caching for mobile devices separately using the module setting “Disable caching on mobile devices”. Just set it to “Yes” to use the same cache as its used for Desktop view. “

Contributing

If you would like to test the beta versions or send us translation file (we provide 50% discount for new translations), please contact us via the support link.

Overrides

  • override/classes/controller/Controller.php
  • override/classes/controller/FrontController.php
  • override/classes/Hook.php