Download & Extend

Implement a hierarchical (primary / secondary) engine

Project:Cache Router
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

This (untested and experimental) code allows to create a primary / secondary engine.

To use, configure it this way:

<?php
$conf
['cache_router'] = array(
 
'<bin>' => array(
   
'engine' => 'hiearchical',
   
'primary_engine' => array(
      
// Your primary (authoritative) engine configuration.
      
'engine' => 'db',
      
'server' => array(),
      
'shared' => TRUE,
    ),
   
'secondary_engine' => array(
      
// Your secondary (slave) engine configuration.
      
'engine' => 'apc',
      
'server' => array(),
      
'shared' => TRUE,
    ),
   
// The maximum inconsistency window.
   
'tombstone_delay' => 10,
  ),
);
?>
AttachmentSize
hierarchy-router.patch3.3 KB

Comments

#1

Title:Implement a hiarchical (primary / secondary) engine» Implement a hierachical (primary / secondary) engine

#2

Title:Implement a hierachical (primary / secondary) engine» Implement a hierarchical (primary / secondary) engine

The caching hierarchy needs to understand two things:
* Which engines are known to guarantee coherency. All engines do on a single server. APC does not when you have multiple web servers.
* Storage into the cache(s) must have an option to specify whether coherency is required. Coherency should be required by default.

#3

Status:needs review» needs work

#4

The caching hierarchy needs to understand two things:
* Which engines are known to guarantee coherency. All engines do on a single server. APC does not when you have multiple web servers.
* Storage into the cache(s) must have an option to specify whether coherency is required. Coherency should be required by default.

For D6 and the cache router, it is your responsibility to configure all this correctly, by understanding which "cache bin" requires consistency and which cache engine is able to offer it. The "hiearchy" set up by design never guarantees consistency, but requires that at least the "primary engine" does.

For D7, I suggest we implement a "cache location" parameter. This could be "node local", "cluster wide, short-term" and "cluster wide, long-term". Depending of the cache engines installed, the routing algorithm will choose an engine to satisfy the requirements of the caller. On a stock Drupal install, all those will be stored in db. On a more advanced setup, those could be APC, Memcache and DB respectively.

#5

wow, this is like a dream, i've been wanting to work on this for so long.

thank you x 100.

my typical recommendation for people is to use cache router in the following manner

shared hosting:
use file cache and/or apc if available

single server:
use apc cache and/or memcache.

multiple web servers:
use memcache only

although with the heirarchalCache, we could make the following recommendations:

shared hosting:
use file cache and apc if available, secondary cache use db

single server:
use apc and/or memcache, and either db or file as backup

multiple server:
use memcache with either file or db backup