MyBB Community Forums

Full Version: Abbreviate the name of the tables in cache
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello, my English is bad. I'm building a forum. but I need 1000 forum. my cache of forums is currently 873.81 KB. when it exceeds 900 KB an error in mysql because it apparently has a limit of 1 mb. I hope to explain properly.

I suggest shortening the names of the tables to cache forums. That would be creating more forums and could reduce the size of the cache.

example: http://community.mybb.com/thread-78328.html



If you are creating a forum that has 1000+ forums, you can expect many problems.

900KB is nothing compared to a forum that needs 1000+ forums.
I found a temporary solution for my problem.

I edit the function update_forums in the file: class_datacache.php :

function update_forums()
	{
		global $db;
		$forums = array();
		
		// Things we don't want to cache
		$exclude = array("description","linkto","lastposteruid", "lastpostsubject","password","showinjump","modposts","modthreads","mod_edit_posts", "modattachments","style","overridestyle", "rulestype","rulestitle", "rules","defaultdatecut","defaultsortby", "defaultsortorder","unapprovedthreads","unapprovedposts", "threads", "posts", "lastpost", "lastposter", "lastposttid");
		
		$query = $db->simple_select("forums", "*", "", array('order_by' => 'pid,disporder'));
		while($forum = $db->fetch_array($query))
		{
			foreach($forum as $key => $val)
			{
				if(in_array($key, $exclude))
				{
					unset($forum[$key]);
				}
			}
			$forums[$forum['fid']] = $forum;
		}
		
		$this->update("forums", $forums);
	}


i add this parameters in the code for exclude:

"description",
"linkto",
"lastposteruid",
"lastpostsubject",
"password",
"showinjump",
"modposts",
"modthreads",
"mod_edit_posts",
"modattachments",
"style",
"overridestyle",
"rulestype",
"rulestitle",
"rules",
"defaultdatecut",
"defaultsortby",
"defaultsortorder",
"unapprovedthreads"

i dont need that options. but can i have problems with that exclusion?
i dont have some error in my forum, but im worried.


the good part is this:

before the change:
forums cache: 873.81 KB
(index.php) Global Parsing Time: 0.0870721 / Memory Usage: 17.25 MB

after the change:
forums cache: 425.5 KB
(index.php) Global Parsing Time: 0.0752232 / Memory Usage: 15.5 MB

Although it may work it's going to mean loading more information every time a page is pulled instead of just taking it from cache.

And, as said in your support thread it's more of an issue with your sites set up than it is with MyBB.
I tried it
if MyBB not find the value in cache, it assigns a 0 or a blank.

MyBB does not charge more information if he can not find the cache value.
If that works for you then that's great. However, a 1mb limit on a database size that has 1,000 forums will soon be breached and you'll need to upgrade or change hosting providers anyway.

You need to find a hosting solution that will match your forum's target size.
There really is absolutely no reason on earth to create 1000+ forums. Very little hosts would be able to hold data from your forum for very long, so I'd really reconsider what site your trying to start and go for a more specific niche.