【发布时间】:2012-02-19 17:24:23
【问题描述】:
由于某些缓存问题,如果存在某些 URL 参数,我需要针对特定模块显式绕过缓存。我找到的解决方法是破解libraries/joomla/document/html/renderer/module.php 中的render() 函数,如下所示:
function render( $module, $params = array(), $content = null )
{
// Existing code:
$mod_params = new JParameter( $module->params );
// My hack:
if ($module->module == 'mod_foo')
{
if (certain URL parameters are present)
{
$mod_params->set('cache', 0);
}
}
...
}
当然,破解 joomla 核心代码是一个糟糕的想法,如果可能的话,我想避免这种想法。那么,是否有一个合适的钩子我可以插入以实现相同的效果?我不认为我可以在模块级别做任何事情,因为如果渲染器已经决定从缓存中获取它,它甚至不会被检查。
【问题讨论】: