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.
- For a full description of the module, visit the project page: https://www.drupal.org/project/cache_heuristic
- To submit bug reports and feature suggestions, or to track changes: https://www.drupal.org/project/issues/cache_heuristic
REQUIREMENTS
- Drupal 7
SUPPORTED MODULES
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['cache_backends'][] = 'sites/all/modules/contrib/cache_heuristic/memcache.deferred.inc';
$conf['heuristic_cache_default_class'] = 'MemCacheDrupalDeferred';
?>
STATIC CACHING
Static caching is provided through the 'static' option, either globally or per bin.
<?php
// Enable static caching for all bins.
$conf['heuristic_cache_default_static'] = TRUE;
// Disable static caching for a single bin.
$conf['heuristic_cache_static_cache_bootstrap'] = FALSE;
?>
BUFFER SIZE
The number of cache entries collected by Cache Heuristic can be controlled through
the option 'buffer_size', either globally or per bin.
Static caching is provided through the 'static' option, either globally or per bin.
<?php
// Infinite buffer size for all cache bins. (default)
$conf['heuristic_cache_default_buffer_size'] = -1;
// Only collect 10 cache entries for cache_field.
$conf['heuristic_cache_buffer_size_cache_field'] = 10;
?>
THRESHOLD
To avoid writing collected cache entries to the database all the time, a threshold
can be set.
<?php
// If any bin has changed more than 5 entries in its buffer, then store the
// collection. (default)
$conf['heuristic_cache_default_threshold'] = 5;
// If there's any difference, whatsoever, in the cache_bootstrap collection,
// the store the collection.
$conf['heuristic_cache_threshold_cache_bootstrap'] = 0;
?>
<?php
// If there are more than 20 changes across all bins, store the collection.
// (Disabled by default)
$conf['heuristic_cache_totalthreshold'] = 20;
?>
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
- Seeking new maintainer
The current maintainers are looking for new people to take ownership. - Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Performance
- 8 sites report using this module
- Created by gielfeldt on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-2.x-dev updated 13 Oct 2015 at 07:13 UTC
Development version: 7.x-1.x-dev updated 6 Jul 2016 at 20:22 UTC