Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hello
i've made some changes and though it would be nice to share ;)
the changes include:
- variable to turn on caching (false, no cache from cacherouter)
- detection of the module inc file (false, no crash)
- automatic path for domain (so the code will less likely need changes when adding to a new site. also good for multi-site environments built with symlinks)
/**
* Cache Router
*
* Cache API for Anonymous users, running on file, db, apc, xcache or memcache engines.
*/
$module_cacherouter_enabled = FALSE;
$module_cacherouter_inc = './sites/all/modules/performance/cacherouter/cacherouter.inc';
if ( file_exists($module_cacherouter_inc) && $module_cacherouter_enabled == TRUE ) {
$conf['cache_inc'] = $module_cacherouter_inc;
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'file',
'servers' => array(),
'shared' => TRUE,
'prefix' => '',
'path' => 'sites/' . $_SERVER['SERVER_NAME'] . '/files/filecache',
'static' => FALSE,
'fast_cache' => FALSE,
),
);
}
posting a similar version for authcache module
Comments
Comment #1
lpalgarvio CreditAttribution: lpalgarvio commentedauthcache suggestion here:
http://drupal.org/node/945656
Comment #2
tetramentis CreditAttribution: tetramentis commentedMay I also suggest adding this (commented on purpose) line to your simplified configuration:
// 'lock_dir' => getcwd() . '/sites/' . $_SERVER['SERVER_NAME'] . '/files/filecache',
This will complement my patch from #979462: using xcache: fopen() [function.fopen]: SAFE MODE Restriction in effect. The script whose uid is X is not allowed to access /tmp.
Comment #3
tetramentis CreditAttribution: tetramentis commentedComment #4
lpalgarvio CreditAttribution: lpalgarvio commentedupdating to allow "default" domain
it would be useful to share this code in the docs for new users that are installing the module, with an advert that they need to change $module_cacherouter_default to "TRUE" to enable "default" domain, and that they need to change $module_cacherouter_enabled to "TRUE" to enable it the module altogether.
// EDIT
changed default behavior to set as "default" domain
and also module path
Comment #5
geekgirlweb CreditAttribution: geekgirlweb commentedThanks for posting this, it was really helpful!
Comment #6
Krummrey CreditAttribution: Krummrey commented#4 works for me
Comment #7
lpalgarvio CreditAttribution: lpalgarvio commentednew version, with lots of changes.
placed file_exists in a IF iteration under the main IF iteration to reduce I/O when turned off.
for cache router (with support for bins):
for auth cache (with support for cache router and memcache):
Comment #8
lpalgarvio CreditAttribution: lpalgarvio commentedchanged descriptions
Comment #9
lpalgarvio CreditAttribution: lpalgarvio commentedchanged descriptions
Comment #10
lpalgarvio CreditAttribution: lpalgarvio commentedComment #11
apadernoI am closing this issue, since it is for a Drupal version that now is not supported.
Please re-open it if the issue is also relevant for other project branches that require a supported Drupal version.