INTRODUCTION

The Cache Heuristic module gathers information on which cache entries are used
on a page, and bulk-loads these cache entries on following requests.

REQUIREMENTS

  • Drupal 7

INSTALLATION

  • Enable the module as usual.

CONFIGURATION

To enable heuristic caching change the cache backend in settings.php:

<?php
 
// Load the cache heuristic backend.
 
$conf['cache_backends'] = array(
   
'sites/all/modules/contrib/cache_heuristic/cache_heuristic.inc'
 
);

 

// Use cache heuristic as default cache backend
 
$conf['cache_default_class'] = 'HeuristicCache';

 

// Use the deferred database cache backend for HeuristicCache
  // (optional, the DrupalDatabaseCacheDeferred is used by default if not specified)
 
$conf['heuristic_cache_default_class'] = 'DrupalDatabaseCacheDeferred';

 

// Use another database connection for the field cache.
 
$conf['cache_target_cache_field'] = 'my_form_connection';

 

// Use tombstone flushing for all bins.
 
$conf['cache_default_tombstone_flush'] = TRUE;

 

// Use database cache directly for cache form (i.e. don't use cache heuristic for cache form).
 
$conf['cache_class_form'] = 'DrupalDatabaseCache';

 

// Use mem cache as default backend for cache heuristic (requires the memcache module)
 
$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
 
$conf['heuristic_cache_default_class'] = 'MemCacheDrupalDeferred';
?>

OTHER

Cache Heuristic also provides a standard database cache backend similar to the
one from Drupal core, but with the following extra features:

  • Configurable database target
  • Tombstone flush mechanism
<?php
 
// Load the cache heuristic backend.
 
$conf['cache_backends'] = array(
   
'sites/all/modules/contrib/cache_heuristic/cache_heuristic.inc'
 
);

 

// Use cache heuristic as default cache backend
 
$conf['cache_default_class'] = 'DrupalDatabaseCacheTarget';

 

// Use another database connection for the form cache.
 
$conf['cache_target_cache_form'] = 'my_form_connection';

 

// Use tombstone flushing for all bins.
 
$conf['cache_default_tombstone_flush'] = TRUE;
?>

FAQ

Does it work as excepted?

I hope so.

Project Information

Downloads