Experimenting with bb-cache
I’ve recently enabled the hard cache, to see how it handles on a test forum with only a few users. The first problem I’ve come across has been an error with $bb_cache->get_forums() – the array it was returning when cached was 0, instead of containing the forum ids.
I fixed it by a simple reversal of the sections of code within the get_forums() function in cache.php:
$forums = (array) $bbdb->get_results("SELECT * FROM $bbdb->forums $where ORDER BY forum_order");
if ( $this->use_cache && $normal && $forums )
$this->write_cache(BBPATH . 'bb-cache/bb_forums', $forums);
$_forums = array();
foreach ( $forums as $forum )
$_forums[(int) $forum->forum_id] = $bb_forum_cache[(int) $forum->forum_id] = $forum;
After reversing them (the above are their original positions), I then made sure the write cache line was using $_forums, instead of $forums.
No idea if this may have other consequences I’ve yet to unearth, but I thought it may be worth noting here.
I’ve also used the “load all options” function from wordpress as a basis for creating a global array containing all topicmeta options. By default (even with cache enabled, although maybe I’ve missed a setting), there were several calls to to topicmeta, whereas only one was really required.
- You must be logged in to reply to this topic.