Consistent Cache
If you're using a cache backend other than the built-in DB, then the cache operations runs outside the database transactions, and this can cause inconsistent cache where cache is being populated with old data.
AutoSlave comes with a cache wrapper that ensures cache is not updated until transactions are committed, thereby preventing old data being populated into cache.
<?php
$conf['cache_backends'] = array(
'sites/all/modules/memcache/memcache.inc',
'sites/all/modules/autoslave/autoslave.cache.inc',
);
$conf['cache_default_class'] = 'AutoslaveCache';
$conf['autoslave_cache_default_class'] = 'MemCacheDrupal';
?>
However, if you're using the isolation level REPEATABLE-READ, then the AutoSlave cache wrapper is not enough due to the consistent snapshot feature of InnoDB. In this case, it is also recommended to use the Cache Consistent (NOTE: Cache Consistent is incomplete at this time).
<?php
$conf['cache_backends'] = array(
'sites/all/modules/memcache/memcache.inc',
'sites/all/modules/autoslave/autoslave.cache.inc',
'sites/all/modules/cache_consistent/cache_consistent.inc',
);
$conf['cache_consistent_transaction_protection'] = FALSE;
$conf['cache_default_class'] = 'AutoslaveCache';
$conf['autoslave_cache_default_class'] = 'CacheConsistent';
$conf['consistent_cache_default_class'] = 'MemCacheDrupal';
?>
The Consistent Cache writes the cache to both memcache and database, providing a MVCC safe fallback for the cache.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion