This project is not covered by Drupal’s security advisory policy.

Cache Router Admin


CacheRouter is a caching system for Drupal allowing you to assign individual cache tables to specific cache technology. CacheRouter has an option to utilize the page_fast_cache part of Drupal in order to reduce the amount of resources needed for serving pages to anonymous users.

Drush integration #642544-12: Weird thing. Keeps happening.

NO DRUPAL 7 VERSION OF THIS MODULE WILL BE RELEASED. See #593238: Do not release Drupal 7 version of this and move the engines into separate projects for details.

Cache Router supports the following technologies natively:

Most of the ORIGINAL code comes from refactoring the following projects: APC, fastpath_fscache, Memcache, and XCache. However the majority of it has been completely rewritten.


  1. Enable the module in admin/build/modules.
  2. Setup your settings.php


CacheRouter has some pretty sane defaults, and it usually won't hurt to leave it in the default mode. With that said there are a few tweaks that are critical especially if you are running multiple sites.

Add the following lines to your settings.php:

$conf['cache_inc'] = './sites/all/modules/contrib/cacherouter/';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'db',
    'servers' => array(),
    'shared' => TRUE,
    'prefix' => '',
    'path' => 'sites/default/files/filecache',
    'static' => FALSE,
    'fast_cache' => TRUE,

If you are using the 5.x branch of this module, you must apply the core "cache serialization" patch.

# cd /path/to/drupal
# patch -p0 < sites/all/modules/cacherouter/patches/DRUPAL-5-7-cache-serialize.patch

default is for the default caching engine. All valid cache tables or "bins" can be added in addition, but you must have a default if you skip any bins.

For engine, the current available options are: apc, db, file, memcache and xcache.

server is only used in memcache and should be an array of host:port combinations. (e.g. 'servers' => array('localhost:11211', 'localhost:11212'))

shared is only used on memcache as well. This allows memcache to be used with a single process and still handle flushing correctly.

prefix is for unique site names usually when running multiple sites.

path is new in beta3 for 5.x and 6.x branches. It allows you to override the default of /tmp/filecache for storing files when using the "file" caching type. *update this now works as of beta8. Also note: when using this module with multi-site setups, you need to change this to point to the file cache for each site. (e.g. sites/, sites/ or you WILL have cache corruption.

fast_cache is new in beta8 for turning page_fast_cache on. WARNING: you will not get Anonymous statistics if you use this option. Please set it to FALSE if you want to get Anonymous statistics.

static is new in beta8 for allowing a bin to keep a static array cache so multiple requests per page will not hit the remote cache. This defaults to FALSE due to the fact that in Drupal 6 there are several caches (menu, localization) that do their own static storage. Advanced feature, use at own discretion.

Related Modules

TODO for 2.0

A few things I would like to have done for the 2.0 release.

  1. Add session support. Just like the memcache project. (I am working on this and it will be done soon.)
  2. Allow cache "chaining", for example, it would be nice to have default and a "backup" cache so for any critical cache (not that there should be critical caches), you could have memcache backed by db or file backed by db or memcache backed by apc backed by db. Not sure how I would like to implement this yet.
  3. Get it into core. I don't see why this caching shouldn't be part of Drupal core.
  4. Any ideas for additional caching types.
  5. I would love to get a really nice, clean web stats thing going with pretty pictures and everything.


CacheRouter is maintained by Steve Rude and Andrey Postnikov (andypost).

Project information