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

For anonymous users I want to serve pages from XCache, but I didnt want to use memory caching as a replacement for every cache table, only serving cache_page content for anon users from XCache.

Some of the code and concept is inspired by Cache Router, Memcache and XCache however for most parts the code is something I wrote in collaboration with Nick Thompson

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 cache doesnt exist in xcache, check db, exists in DB? save it in XCache & serve page
-- page doesnt exist in XCache or DB? Generate page, cache it in DB and Xcache, serve 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

<?php
$conf
['cache_inc'] = './sites/mysite/modules/xcache_cachepage/xcache_cachepage.inc';
$conf['page_cache_fastpath'] = TRUE;
?>

- enable cookies

- enable the module

Project Information

Downloads