这是在xoops.org总站发布的一个hack
已经加入到xoops2.2中了
所以。。。没有必要再用了,等xoops2.2罢
总站告诉我原来的下载不能用了,让更新一下。我就顺便也放到这里罢
This is a revised download since the site url changed.
And it might be less vague if use the title of "cache on change"?
[July 20, 2004]
OBJECTIVES:
Make the cache system more flexible and more efficient
for different modules
HOWTO:
1 modify XOOPS_ROOT_PATH/kernel/module.php:
class XoopsModule extends XoopsObject
{
...
// clear module/block cache files
function clearCache()
{
// clear module cache files
// clear relevant block cache files
}
//Update the module cache
function updateCache()
{
$this->clearCache(); // clear module/block cache
files
// create module cache files TODO
// create block cache files DONE
}
}
2 call xoopsmodule::updatecache where necessary. For
instance, in the post.php of newbb module, add the
following right after notification handling:
global $xoopsModule; // not necessary for this
specific case
$xoopsModule->updateCache();
3 related configurations
(1) For a static module such as an article module, or a
dynamic module with no click or view stats: set the
relevant cache time parameters with a huge value, for
say 1 week, 1 month or even use cache_lifetime. In this
case, queries will only occur when new submission or
database update happens.
(2) For a dynamic module, such as forum: set relevant
cache time with a regular value. In this case, cache will
work in regular way if no update occurs but update can
take effect in real time once submission or update
happens.
4 BENEFITS
1 speed up xoops page loading by reducing queries
2 speed up xoops display update by using event-
triggered cache update
5 NOTE:
Alternatively, this hack can be made in
XOOPS_ROOT_PATH/class/template.php
as following:
1 update ROOT/class/template.php file
2 in corresponding module files, for instance:
ROOT/modules/newbb/post.php::
include_once XOOPS_ROOT_PATH . '/class/template.php';
...
just after $notification_handler->...
xoops_update_module_cache($xoopsModule);
HAS NOT BEEN FULLY TESTED YET.
more details available in case you are interested.
read the readme.txt plz.