... Elxis version 2009.3 codename Aphrodite is out, download it from Elxis Download Center (EDC) ...

Static cache

From Elxis Official Documentation

Jump to: navigation, search

Static cache is a new file caching system introduced in Elxis 2009.0. Static cache in comparison to the Standard Cache caches whole pages instead of partial page blocks. Static cache can provide huge speed improvements on heavy loaded web sites especially if it is combined with the enable of gzip compression. To use static cache SEO PRO must be enabled. Static cache can be enabled from within Elxis global configuration (tab Cache).


Contents

Expand static cache

By default Elxis static cache is enabled only for core components. You can expand static cache to third party components via Softdisk. To enable static cache for a component just insert a new entry in Softdisk during the component's installation. Off course you can insert this entry any time but during component's installation is the best choice. IOS Gallery component uses exactly this option (use it as a sample). This new entry should be in Softdisk's section STATICCACHE and should have name the same as the component's starting with "com_" in uppercase. Example: COM_SUPERDUPPER. The value of the Softdisk parameter should be of type STRING. If this value is empty static cache will be applied to all component's tasks towards Elxis' index.php. If you want for some tasks/pages Elxis to disable static cache then fill-in as value a comma separated list of the tasks that you want to exclude from caching.


A simple request to an Elxis component is like this: index.php?option=com_xxx&task=yyy


Add/edit softdisk entry for static cache
Add/edit softdisk entry for static cache

So, let's say that you are the developer of the component Sports that shows sport news and game results. To enable static cache for your whole component create this softdisk entry:

sdsection = STATICCACHE
valuetype = STRING
sdname = COM_SPORTS
sdvalue =

To exclude certain tasks from caching write down the excluded tasks in the sdvalue parameter:
sdvalue = new,edit,save,update

We are only interested in tasks towards index.php. For tasks towards index2.php Elxis static cache is automatically disabled by Elxis.

Automatic disable of static cache

Static cache is automatically been disabled on any of the following cases:

  • For logged-in users.
  • For the Elxis' core components: Search, RSS, login and Banners.
  • For third party components (except if they are enabled via SoftDisk).
  • For requests towards index2.php file.
  • For SEO PRO URLs containing query strings.
  • For pages were the mosmsg URL parameter is set.
  • After submitting forms (contact, vote, comments, etc).
  • If the cached page can not be generated.


Forced regeneration of cached page

If you need to refresh a cached page just set the cacheregen parameter either via GET or POST method (the value of the parameter has no importance). This will force Elxis to regenerate the cached page regardless if it has expired or not.

Example requests using the GET method to refresh a cached page:

http://www.mysite.com/links/?cacheregen
http://www.mysite.com/section/category/article.html?cacheregen

Clean static cache

To clean (empty) static cache use the Elxis tool Clean cache.


Known problems

Short open tag PHP directive (short_open_tag) may generate problems on the inclusion of the cached pages because of the XML prologue on the top of the pages. Elxis detects automatically if short_open_tag is enabled on your server and uses a workaround method to include the page (this workaround spends more server memory than the normal method). If ini_get function is not available on your server Elxis won't be able to perform this diagnostic task. In this case edit manually includes/Core/staticcache.php file and make Elxis work continuously with the workaround method.

We strongly recommend you to set short_open_tag to off. This directive is not within the standard PHP's coding style, Elxis does not require it and is going to be removed from PHP in PHP 6. If you are allowed to use function ini_set you can disable short_open_tag by adding the following in the top of index.php file:
ini_set('short_open_tag', 'off');
Personal tools