![]() |
Homepage Statistics Cache
A little while ago I ran into this problem... I like having a lot of statistics on my forum's homepage, but I don't like having a lot of queries on that page. That got me to start thinking of a better way to do it, hence the creation of this hack.
How does this hack work? It's pretty simple really. Instead of counting every single thread, post, member and etc every time someone loads your forum, it only counts these after a specified amount of time and updates one table that the information will be pulled from. This hack is especially useful for high traffic sites and can reduce the time it takes to load your forum's homepage. Statistics Included: Total Threads Threads Today Total Posts Posts Today Total Members Newest Member Top Poster Top Thread Starter If you are an admin, it will show you the last time the stats were updated as well. (Please note that some of these started as hacks from other members at vB.org. Most of them are so simple though I don't see much of a point in trying to figure out which one's I got from here X months ago. If your hack was included here and you would like credit given please post here and I will add it.) Normally these stats would add 8 queries to your forum's homepage. With this hack installed it will only perform 1 query most of the time, and 9 queries when it needs to update the information. I have found this very useful to cut down on the number of queries on my homepage, decrease the page's loading time, and put less overall stress on my server. Well that's about it. I hope some others will find this hack useful and if anyone has some suggestions for other stats they would like to include in the stats cache please let me know and I will try to implement them. |
There's not much to it, but here's a screen shot as well. :)
|
looks nice, ill try this out ty
|
this also makes my last post on forum home hack update every ten mins along with the rest of the stuff you included above.
Is there anyway I can change this? |
clicksm install
|
nevermind.. my fault
It saves 8 queries per load for me |
How can we also cache the moderatorlist ?
XENON has a hack for this.. but it isn't compatable with this hack https://vborg.vbsupport.ru/showthrea...=&pagenumber=1 |
Thanks for pointing that out SgSling. I had forgotten about his modifications (I have Xenon's hack installed too). He saves another query by counting the posts in the thread query, so to use that with this hack you would just replace this (in the hack itself, or index page if you've already modified it):
PHP Code:
PHP Code:
|
Lets say I wanted to add a few more items to be cached ...
1 - Total Thread Views 2 - New Members Today 3 - Most popular thread by # of Replies These 3 items I have installed, but they dont show now since I added this hack. (A nice one might I add). I know (or i think rather) I need to add them into the table via a query, then adjust accordingly on the forumhome template ... But since im new to it, (i already ran the intial query), how can I add to the exist newly created table? (IE: add this to the statscache table) ... Any/All help appreciated!! |
Snapperhaed - The first 2 wouldn't be hard to add at all. If you'll give me a link to the 3rd one you're talking about I'll have a look at it to see what would need to be done to add it as well. :)
Oh, and those things should still work fine without the stats cache as long as you didn't modify any of the code that was for those hacks... |
All times are GMT. The time now is 07:41 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|