MyBB Community Forums

Full Version: Query Cache
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have a rather simple query and I would like to cache it:
    $container = '';
	$altbg = alt_trow();
	$content = '';
	$query = $db->query("
        SELECT id, name, thumbnail
		FROM ".TABLE_PREFIX."directory
		WHERE m.hidden=0 
        ORDER BY m.name"
	);
	while($list = $db->fetch_array($query))
	{   
        $list['cid'] = $list['id'];
        $list['list'] = htmlspecialchars_uni($parser->parse_badwords($list['name']));
		if(my_strlen($list['name']) > 25)
		{
			$list['list'] = my_substr($list['name'], 0, 25) . "...";
		}
        $list['cover'] = $list['thumbnail'];
		
		eval("\$content .= \"".$templates->get("directory_content")."\";");
		$altbg = alt_trow();
	}

    if($content)
	    {
       eval("\$container = \"".$templates->get("directory_container")."\";");
        }




but I have no idea how the cache works and when or how to update the cache.

Would appreciate if some one could post some sample code based on my sample.

Thanks in advance...
Please try to provide more details, how are you trying to cache the data and what for?