CacheCracker Extension

CacheCracker is an extension to give you complete control over caching in your ExpressionEngine system. It is designed to be installed at any time, including when first starting development on a new project, giving development and your production site a potentially massive speed boost.

Features

CacheCracker has the following features:

CacheCracker Documentation

Functionality

Global

The following settings are applied globally to CacheCracker.

Settings

Forced Caching

Forced caching is designed to allow you to quickly setup global cache settings for all of the templates on your site. You can also optionally select only specific template groups to force caching on. It's a good idea to turn on this setting when first setting up a new site, to make sure that all newly created templates are automatically cached with your global settings.

If you do not want to cache certain templates, you can use a combination of the Force caching for template groups option and the normal Design > Templates > Template Preferences manager to turn on caching only for individual templates.

We recommend keeping templates that cannot be cached in a common group or groups so all other templates can be more easily cached. Normally, for instance, you would not want to cache a forms template group or a account template group since these contain information specific to a session or user.

Settings

Expire on Editing Templates

Cache files can be automatically reset when templates are edited in the filesystem. ExpressionEngine does not by default reset cache files when template files are edited.

Settings

Expire on Content Publish

This feature automatically resets cache files when needed to immediately show published content on the live site. It is recommended that you make use of the Channel Settings options to only clear the templates that actually make use of specific channel data. You can also have all cache files reset on every publish, however this will drastically reduce the performance of your site when editing content.

Settings

Shared Global Caching

By default, ExpressionEngine always runs each embed template for each URL on the site, and caches the results only for that URL. This is a huge performance issue with complex headers, footers, menus, or other embedded templates that are identical (or nearly identical) on every execution.

Shared Global Caching automatically copies or symlinks these cached results into all other pages that make use of them to prevent these expensive embeds from running more than once.

When using this option you must use complex conditionals on most global variables, otherwise the results of the conditional will be cached, which is likely not what you want.

One easy way to make a conditional "complex" is simply to place parenthesis around it's expression, like so:

{if (segment_1 == 'about-us')} ... {/if}

If you would like to use segment or global variables in template output, see the next section for Late Global Parsing.

Activating

Settings

Late Global Parsing

Normally, segment variables, members vars and other globals are stored in the cached version of a page and are not re-parsed. Using this new syntax allows you to use these variables in cached templates and still get the current value substituted, rather than whatever the value was when the template originally ran.

Mainly used in combination with the Shared Global Caching feature, this feature provides a new syntax that allows global variables to be used in output of cached templates.

The new syntax has this format:

{#variable_name#}

This feature requires the free Wallace extension.

Settings

Optional Core Hack

The optional core hack can be applied to fix issues when using caching in combination with the Structure or Uhura modules. These modules modify the segments array used by EE to create cache directories for each URL. Because of this, two issues can arise:

Applying the core hack is easy, simply follow these steps:

  1. Find the file system/expressionengine/libraries/Core.php.
  2. Find the line that reads require APPPATH.'libraries/Template.php'; (in the current version this is on line 609).
  3. Replace the require line and the following line that includes new EE_Template() with the following lines:
// BEING CacheCracker modification
require_once PATH_THIRD.'cache_cracker/libraries/CC_Template.php';
$this->EE->TMPL = new CC_Template();
// END CacheCracker modification

After making this change, test your site well to confirm that all is well.