Page Index Toggle Pages: [1] 2 3 ... 5 Send TopicPrint
Very Hot Topic (More than 25 Replies) Board Index User Cache 1.4 for YaBB 2.1 only (Read 19100 times)
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Board Index User Cache 1.4 for YaBB 2.1 only
Oct 8th, 2005 at 1:55am
Print Post  
Latest version: Board Index User Cache 1.4 for YaBB 2.1.

If you absolutely need a version for YaBB 2.0 Final, I've attached 1.3 to the last post, which will work for 2.0.

This mod is a behind the scenes mod that is meant to make YaBB 2 faster and easier on your server. YaBB 2 is much better then YaBB SP 1, but it still opens up many files when viewing the Board Index.

This mod caches the important variables in those files (regdate, regtime, realname, position, addgroups) that are needed to properly display the user on the BoardIndex. After a cache file is built for the current BoardIndex, it loads from this file while the data is considered new enough to use. I also made the MessageIndex use it so it can benifit from this (but it does not update the cache).

At the time of the first post, my mod is using the cache for 12 users instead of opening the user's .var file (saves 12 file opens!). If you want to see what is loaded from cache, turn debug mode on, invalidate the cache in the admin center, and go to the BoardIndex. In the Opened Files list, there will be entries that show what users are loaded from cache rather then files.

Feedback is appericated, as this is not tested very well (my host has been going up and down since a week or two before I installed this mod on my site Sad).

VERSION HISTORY:
1.4 (YaBB 2.1): Updated for 2.1. Added eval() for topic listing too. Added German translation. Changed the directory structure of the mod zip file to make it more like the real YaBB structure. (November 10th, 2005)
1.3 (YaBB 2 Final): Used eval() to trap errors created by the cache. (October 25th, 2005)
1.2 (YaBB 2 Final): Fixed regtime error with Guests. (October 12th, 2005)
1.1 (YaBB 2 Final): Made storing of data safer. Also fixed dates in headers of the lang and admin files. (October 8th, 2005)
1.0 (YaBB 2 Final): Mod package made available on BoardMod.
« Last Edit: Nov 11th, 2005 at 4:55pm by AK108 »  

biuc1.4.zip ( 5 KB | Downloads )

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
Spikecity
God Member
*****
Offline


Beer anyone ?

Posts: 2630
Location: New York
Joined: Apr 16th, 2002
Gender: Male
Re: Board Index User Cache 1.0 for YaBB 2 Final
Reply #1 - Oct 8th, 2005 at 9:20am
Print Post  
Why 12 users AK ?
If the message index is set to 15 you miss out on three potentially different users ?
I dig the cache concept but the number of userdata cached should be dependent of the length of the message/boardindex length in order to capture all of the user data ?
Or do I not get what you are doing here ? Wink
  

Nothing to add here Smiley
Back to top
 
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.0 for YaBB 2 Final
Reply #2 - Oct 8th, 2005 at 2:47pm
Print Post  
No, I was just giving an example of what I saw on my small forum. It will cache as many users as it can from the BoardIndex. It uses %memberaddgroup to find out who's loaded.

As for the MessageIndex, it just loads the data, and doesn't update it. I figured that updating it could make the cache file too large, but it can gain benifits from using it.

Anyway, I thought of a bug on this last night Lips Sealed I'll fix it when I get back and upload a new modfile. Don't use this on forums with users with a ', \, or multibyte character in their name until then.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.0 for YaBB 2 Final
Reply #3 - Oct 8th, 2005 at 8:12pm
Print Post  
1.1 is out with a small fix in how it handles a backslash in the user's display name and other places. See the top post for more details.

By the way, could someone report how this works with multibyte characters in the display name of a user? I'd appericate it since I can't test it on my computer.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
kibonge
New Member
*
Offline


I love YaBB Foren!

Posts: 15
Location: Burkhardtsdorf
Joined: Sep 15th, 2003
Gender: Male
Re: Board Index User Cache 1.1 for YaBB 2 Final
Reply #4 - Oct 10th, 2005 at 3:44am
Print Post  
after the installation i becom this error

Quote:
Untrapped Error:
syntax error at ./Variables/boardindexusers.cache line 5, near "= ;" Compilation failed in require at ./Sources/BoardIndex.pl line 28. Compilation failed in require at YaBB.pl line 173.
  

first Kenya ........... for ever Kenya
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.1 for YaBB 2 Final
Reply #5 - Oct 10th, 2005 at 7:10pm
Print Post  
Could you post your ./Variables/boardindexusers.cache file here? Other then that, invalidate the file using the Admin Center, and see if it happens again. If so, chances are it's a problem with a user's display name. Check for any backslashes (\), single quotes ('), or non-English letters.

Edited:
Found a similar thing happening on my board with it trying to store a guest's info (username was an IP address). Once I see the kibonge's cache file (f he lets me), then I'll release a full fix to it.

Can anyone else duplicate this?
« Last Edit: Oct 10th, 2005 at 9:26pm by AK108 »  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
kibonge
New Member
*
Offline


I love YaBB Foren!

Posts: 15
Location: Burkhardtsdorf
Joined: Sep 15th, 2003
Gender: Male
Re: Board Index User Cache 1.1 for YaBB 2 Final
Reply #6 - Oct 11th, 2005 at 4:23am
Print Post  
ok,

this the first 11 from my boardindexusers.cache


if(1129004913 > time) {
     ${$uid.'Xena'}{'realname'} = 'Xena';
     ${$uid.'Xena'}{'addgroups'} = '';
     ${$uid.'Xena'}{'position'} = '';
     ${$uid.'Xena'}{'regtime'} = 1113207080;
     ${$uid.'Xena'}{'regdate'} = '04/11/05 um 11:11:20';
     ${$uid.'Xena'}{'userwasloadedfromcache'} = 1;
     ${$uid.'New_Life'}{'realname'} = 'New_Life';
     ${$uid.'New_Life'}{'addgroups'} = '';
     ${$uid.'New_Life'}{'position'} = '';
     ${$uid.'New_Life'}{'regtime'} = 1121587914;
     ${$uid.'New_Life'}{'regdate'} = '07/17/05 um 10:11:54';
     ${$uid.'New_Life'}{'userwasloadedfromcache'} = 1;


sorry my english is verry bad

kibonge
  

first Kenya ........... for ever Kenya
Back to top
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.1 for YaBB 2 Final
Reply #7 - Oct 11th, 2005 at 10:22pm
Print Post  
Hmmmm. I don't see anything wrong with it, but I'll make a safer version that uses eval() and other safer ways of storing the data (at least until I catch the errors). 1.2 should be out hopefully tonight.

Thanks for your help though.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
gus
New Member
*
Offline


I love YaBB 1G - SP1.2!

Posts: 43
Joined: Aug 12th, 2005
Re: Board Index User Cache 1.1 for YaBB 2 Final
Reply #8 - Oct 13th, 2005 at 12:29am
Print Post  
I get a problem like that too.  It's caused by a guest IP.

I don't have any guests online right now, so I can't pull off the code.  However, I do remember exactly what caused the problem, and how I temporarily fixed it.

Using kibonage's code as an example

Code
Select All
 if(1129004913 > time) {
     ${$uid.'Xena'}{'userwasloadedfromcache'} = 1;
     ${$uid.'New_Life'}{'realname'} = 'New_Life';
     ${$uid.'New_Life'}{'addgroups'} = '';
     ${$uid.'New_Life'}{'position'} = '';
     ${$uid.'New_Life'}{'regtime'} = ;  #line that causes error
     ${$uid.'New_Life'}{'regdate'} = '07/17/05 um 10:11:54';
     ${$uid.'New_Life'}{'userwasloadedfromcache'} = 1;  



I think that the problem is that a guest has no "regtime."  I'v enoticed that there are no single quotes around the "regtime."
  
Back to top
 
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #9 - Oct 13th, 2005 at 2:00am
Print Post  
Yeah, I caught that. Since regtime is usually a number, you don't need quotes, if it exists.

Here's 1.2 , which adds those quotes back in.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
astropilot
God Member
*****
Offline



Posts: 828
Location: Louisville
Joined: Jun 18th, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #10 - Oct 13th, 2005 at 2:05am
Print Post  
AK108,

Just a quick question....why would a Guest's info be cached anyway?  You have in the sub added to BoardIndex.pl
Code
Select All
if ($user eq 'Guest') {next;} 


None of their info should be added to the file.

ap
  

"For I am not ashamed of the gospel of Christ..."
Romans 1:16
---
http://www.ssflynn.com
www.flynnfarmsofkentucky.com
Back to top
 
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #11 - Oct 13th, 2005 at 2:08am
Print Post  
That prevents it from being cached. Since we're checking the memberaddgroup hash to determine who was loaded, and 'Guest' is an entry in the memberaddgroup hash if you are a Guest, this is an easy way to skip it.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
astropilot
God Member
*****
Offline



Posts: 828
Location: Louisville
Joined: Jun 18th, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #12 - Oct 13th, 2005 at 2:15am
Print Post  
Quote:
this is an easy way to skip it.

That's my point.  The Guest should not even be added to the hash, but because you have this undefined error, Guests seem to be.
  

"For I am not ashamed of the gospel of Christ..."
Romans 1:16
---
http://www.ssflynn.com
www.flynnfarmsofkentucky.com
Back to top
 
IP Logged
 
AK108
God Member
*****
Offline



Posts: 942
Joined: Oct 1st, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #13 - Oct 13th, 2005 at 2:20am
Print Post  
The memberaddgroup hash is made by YaBB 2, not my mod. I just read from it, but never write to it.
  

For my mods, check out my public notes.

You might be interested in my projects, or my forum, the Flying Kirby Pub.
Back to top
WWWAIM  
IP Logged
 
astropilot
God Member
*****
Offline



Posts: 828
Location: Louisville
Joined: Jun 18th, 2003
Gender: Male
Re: Board Index User Cache 1.2 for YaBB 2 Final
Reply #14 - Oct 13th, 2005 at 2:26am
Print Post  
I know. I think we are speaking of two different hashes (which is my fault).

In the original error, in reply #4, the error happed when YaBB tried to compile boardindexusers.cache, right?  Because everyone has a reg time and only Guest do not, to me this means that Guest are being added to the hash in boardindexusers.cache.
  

"For I am not ashamed of the gospel of Christ..."
Romans 1:16
---
http://www.ssflynn.com
www.flynnfarmsofkentucky.com
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 ... 5
Send TopicPrint