SourceForge has been redesigned. Learn more.

#31 speed up xoops by updating cache in real time


Make the cache system more flexible and more efficient
for different modules

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

// 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

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

(Thanks herko for helping make this description clearer
though perhaps still not clear)

1 speed up xoops page loading by reducing queries

2 speed up xoops display update by using event-
triggered cache update

Alternatively, this hack can be made in


  • D.J.

    D.J. - 2004-05-04

    hacked kernel-module.php

  • Jan Pedersen

    Jan Pedersen - 2004-08-03

    Logged In: YES

    I have tried this and it seems to work very well. I am not
    sure, whether this is a the best method, but that is mainly
    due to my ignorance in this area.

    As with all caching, one should also pay attention to pages
    with extra information such as reply/edit buttons, which
    should only be available to certain people. For instance the
    comments are quite useless with this, unless one removes the
    admin available information and the edit and delete buttons
    from the comments.

    All in all - as we have also discussed in the core dev team
    - the Smarty caching is really not very well suited for
    pages that show different information depending on the
    user's permissions.

  • Julio Napuri Carlos

    What about it D.J. ?

    I suppose that with XoopsCache Class replace you old suggestions?


Log in to post a comment.