Last updated 7 April 2014. Created on 12 December 2010.
Edited by cosolom, znerol, Vacilando, Jonah Ellison. Log in to edit this page.


  1. Set up a Drupal cache handler module (optional, but strongly recommended)

    Download a cache handler module, such as:

    Open your settings.php file and configure the cache handler module. Here are some examples:

    Cache Router Module

    $conf['cacherouter'] = array(
      'default' => array(
        'engine' => 'apc',               // apc, memcache, db, file, eacc or xcache
        'servers' => array(),             // memcached (host:port, '')
        'shared' => TRUE,                // memcached shared single process
        'prefix' => '',                  // cache key prefix (for multiple sites)
        'path' => 'files/filecache',     // file engine cache location
        'static' => FALSE,               // static array cache (advanced)
        'fast_cache' => TRUE,            // for turning page_fast_cache on

    Memcache API Module

    $conf['memcache_servers']  = array('' => 'default');


  2. In settings.php, make sure $conf['cache_inc'] loads Authcache:
    $conf['cache_inc'] = './sites/all/modules/authcache/';

    Authcache will automatically try to include the Cache Router or Memcache file include. If you are using a different cache module, or if the module is in a different parent directory than Authcache, define the the cache include path using:

    $conf['cache_inc_via_authcache'] = './sites/path/to/module/';

    If no cache handler is setup or defined, Authcache will fallback to Drupal core database cache tables and "Authcache Debug" will say "cache_inc: database"

    If you are experimenting with multiple caching systems (db, apc, memcache), make sure to clear the cache each time you switch to remove stale data.

  3. Enable the module and configure the Authcache settings (Site Configuration -> Performance -> Authcache).
  4. Modify your theme by tweaking user-customized elements (the final HTML must be the same for each user role). Template files (e.g., page.tpl.php) will have several new variables:
    • $user_name to display the logged-in user name
    • $user_link to display the name linked to their profile (both work for cached and non-cached pages).
    • $is_page_authcache is set to TRUE in all template hooks if the page is to be cached.


How can I tell if a page has been cached?
View the page source and scroll to the bottom to find a few stats stored in an "authcacheFooter" JSON object. You may also enable a debugging window for specific users or roles. The admin account (uid #1) is never cached. By default, admin pages and user pages are not cached either.

Why do my cached pages keep disappearing?
Page cache is cleared when cron.php is executed. This is normal Drupal core behavior.

How do I use Authcache on a multi-site (same domain with subdomains or subdirectories)?
In settings.php, modify the session settings to explicitly define the path/domain for the session cookie:

ini_set('session.cookie_domain', '');
ini_set('session.cookie_path', '/foo');

Looking for support? Visit the forums, or join #drupal-support in IRC.