Topic: Should caching the forum stats show any visible improvements?

Topic says it all.

Re: Should caching the forum stats show any visible improvements?

Which stats?

Re: Should caching the forum stats show any visible improvements?

I would assume that orlandu63 means stuff like names, moderators, descriptions, last posts, topic counts, and post counts. The first and third items could be cached when settings change in the admin area, the second could be updated in the admin section of the profile when changed, and the latter three could be updated upon the creation of a post. If so, this would probably belong in feature requests, but I'll wait to see what orlandu63 says before I move this topic.

Looking for a certain modification for your forum? Please take a look here before posting.

Re: Should caching the forum stats show any visible improvements?

Yes, that and the 'stuff'(for lack of a better word) are exactly what I meant. But now I've changed my mind - there's no point in caching such dynamic values (like total number of posts) since it changes so rapidly, there will be only a small increase in server load (heck, maybe even an increase with all that disk usage). And if your forum isn't very popular, recalculating the stats won't really affect your others users' experience, if at all. But things like moderators, that have a semi-static value, should be cached.

Re: Should caching the forum stats show any visible improvements?

But the per-forum moderator list is stored in the forums table and is grabbed when we grab the forums, so I'm not sure how that would be implemented.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Should caching the forum stats show any visible improvements?

Rickard wrote:

But the per-forum moderator list is stored in the forums table and is grabbed when we grab the forums, so I'm not sure how that would be implemented.

It's doable though. Make an associative array and store the array of the moderators (serialized or not) as a sub-array. So something like this:

<?php
$moderators = array(
// forum_id => moderators
1 => array('Connorhd', 'Smartys')
)
?>

Might be harder to make a cache file for tho.

Re: Should caching the forum stats show any visible improvements?

Yes, but why? Fetching the data from the database (like we do now) is very fast since it's part of another query we have to run anyway. If fetching the moderators was a separate query, caching it to disk would make sense.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Should caching the forum stats show any visible improvements?

I don't mind the current way tongue

There's plenty of caching being done already, and I don't think that should be done even more. I was just offering a solution.