XCache Cachepage module provides an alternative cache.inc file to serve anonymous page requests from xCache (Drupal 6 Only). This module makes use of DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE and implements page_cache_fastpath().

The Concept

  • Set a cookie for logged in users (anon/auth flag).
  • page_cache_fastpath() checks if cookie is not set.
  • If cookie is set (auth user):
    • Proceed as normal, standard drupal cache functions (no cache).
  • If cookie is not set (anon):
    • Check if cached page exists in XCache, if it does serve the page.
    • If the page does not exist in XCache then check the database table ({cache_page}). If it exists in the database, save it in XCache & serve that page.
    • If the page does not exist in XCache or the database, then generate page from scratch, cache it in the database & XCache and serve the page.

This module does not use XCache for any other cache tables apart from {cache_page} for anonymous users. All other cache tables use standard cache.inc functionality. Only the anonymous traffic will be affected.

If you want a complete cache replacement you can use Cache Router, Memcache etc.

Installation

  • This module requires version 1.3.0 or higher of XCache (http://xcache.lighttpd.net/). Do not install if your XCache version is lower than 1.3.0
  • add the following PHP code to site settings.php
    $conf['cache_inc'] = './sites/mysite/modules/xcache_cachepage/xcache_cachepage.inc';
    $conf['page_cache_fastpath'] = TRUE;
    
  • Enable cookies
  • Enable the module