由于一些缓存问题,如果存在某些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核心代码是一个可怕的想法,如果可能的话,我想避免这个想法。那么,有没有一个合适的挂钩我可以插件来实现同样的目的?我不认为我可以在模块级别做任何事情,因为如果渲染器已经决定从缓存中获取它,它甚至不会被检查。
要回答第一个问题否,没有模块渲染事件,以下是Joomla中的插件文档和事件列表!
关闭模块的缓存。
请参阅这篇关于Joomla艺术的文章,您可以查看的其他文章:
-
使用缓存加速代码
-
JCache API