Static Caching


The static driver is blazing fast. It is the fastest driver available in CE Cache, but it may not always be the right tool for the job. Unlike the other drivers, the static driver caches an entire page, and does not allow for fragment caching. For this reason, you cannot escape certain parts of your template to remain dynamic when using the static driver. If you have pages that do not have dynamic content (like displaying content when a user is logged in or out), then the static driver should be a good fit.

How It Works

The server will check to see if the static driver has already made a flat html file of the requested page in the past. If a flat file is found, it will serve it up, completely bypassing ExpressionEngine®. If it has not, or if the page has expired, then the page will be requested from ExpressionEngine® and cached to a flat html file.


View the static driver installation instructions.


To use the static driver, you simply need to add the static tag to your template (view the static tag documentation for more information):


It does not matter where in the template the tag occurs, as the entire page will be cached. If an embed or snippet contains the tag, then the entire page will still be cached.

Control Panel

All of the goodness of the control panel is available to the static driver, including optionally refreshing items when deleting them. Cache breaking also works the same way it does with the other drivers.

How To Rename The Static Directory

By default, the static driver caches to the static directory in your web root. If you wish to change the name of the directory to something new, like new_name for example, you would do so by making changes in the following three places:

1) .htaccess

Change the instance of /static/ce_cache/ to /new_name/ce_cache

2) _static_cache_handler.php

Change this:

private $cache_folder = 'static';

to this:

private $cache_folder = 'new_name';

Do not set the cache folder to the same directory as your web root directory, or set this as a blank string (eg: ''). The directory needs to be a dedicated cache directory. When the cache is cleared, all files in it are deleted.

3) config.php

Add the following config item:

$config['ce_cache_static_path'] = $_SERVER['DOCUMENT_ROOT'] . '/new_name';

or alternatively add:

$config['ce_cache_static_path'] = FCPATH . 'new_name';