Request quote

Elgg – galliCache plugin : A performance booster for your elgg websites

Posted on: December 24th, 2012 by Mahin No Comments


galliCache is an elgg plugin, which caches your site’s public pages and serve your users with these cached pages. The plugin is available for Elgg 1.8 websites only. By using this plugin you can avoid plenty of DB queries and this will speed up your Elgg website significantly. Unfortunately it still means loading the PHP engine to serve the cached files.

Make a Donation

We are releasing this plugin to the public as GPL with the confidence that this paypal-donate will be an extremely useful plugin for you. If you find it useful, dont forget to make a donation. This will ensure the future developments of this plugin. You can buy us a coffee ;)

Download and Install

  • Deactivate and remove any existing instances of galliCache plugin.
  • Download the newest version of the galliCache plugin from the Elgg community repo or from our site.
  • Unzip the file and upload it to your mod directory
  • Enable the plugin in the site’s admin panel and go the Settings > galliCache


  • After finishing installation, you need to configure the plugin properly.
  • Cache Validity :  This is the maximum age / validity assigned for a cache file in seconds. Once the validity of a cache file is over, it is automatically deleted and a new file is generated
  • Exclude contexts from cache : If you want to exclude some contexts from getting cached, enter these contexts name as comma “,” separated values.
  • You need to have a working daily cron job to empty the junk / expired cached files. Otherwise the size of your cache directory will keep on increasing. See this tutorial on How to create a cron job for Elgg? 
  • You need to enable the sites simple cache (In administration > Advanced settings)

Extra bits

If your web server supports “if modified since” header, you can get an extra performance boost by adding the following snippet to your .htaccess file.

<IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]

How do I know if my web server supports the If-Modified-Since header? : You can try this online tool for If Modified Since header. You can also look for the status code of 304 in any of your logs. if you can find 304 status. then your web server supports this header. If you can’t do that then you should call your web host and ask them. When deciding on a web host this is one of the questions you should ask. “Does your web server support the “If-Modified-Since HTTP header?” Virtually every modern hosting company supports it, but it is still worth checking.

How it works

When a visitor who is not logged in visits your site they will be served a static HTML page from the cached (html_cache) sub directory within the Elgg’s data directory. If you navigate to that directory you can view all these files as php files within the directories.

To determine if a page has been cached, view the source and the last lines on the page should read something like

<!-- Generated on Monday 24th of December 2012 01:37:06 PM .-->
<!-- Static page served using Elgg-galliCache(1.0) -->

If a page is not cached it will show  a message like

<!-- Generated on Monday 24th of December 2012 01:37:06 PM .-->
<!-- Dynamic page generated. Page not cached by Elgg-galliCache(1.0) -->


  • Works out of box with any Elgg 1.8 installation
  • Easy to configure.


  • Don’t expect a cheap hosting plan to survive a major traffic spike, even if it is cached!
  • Remember that dynamic contents of the sites like activity river etc, will only refresh when the cached pages are refreshed. This timeout value can be modified, but cached files will only be removed if you have a healthy mix of static and dynamic requests.


Here is a quick bench mark result. With the plugin enabled you can save more than 60% loading time.


Before Caching

After the caching

After the caching

If you are having some good benchmark results with this plugin, dont forget to share it. Send the details to us at info [at] webgalli [dot] com

Sites using the galliCache

Here are a few of the sites that used and helped us build and debug galliCache (inform us about the performance boost you had and we will add your sites too):

Tags: , , , , , ,