RE: [PHP] Cacheing data form PHP script
| From: | daniel at electroteque dot org | Date: | Thu, 29 Jan 2004 01:07:16 +0000 |
| Subject: | RE: [PHP] Cacheing data form PHP script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176152@lists.php.net to get a copy of this message | ||
Here is my final layout, i still yet to test it on the production machine
being a dual 2G xeon, has had major performance issues generated list menus
onto the screen and load time.
function asset_type_list2($tID=null,$tab_index = null,$cache_data =
null,$disabled = null) {
global $db;
if ($cache_data) {
$query = $db->check_menu_cache
('asset_types','asset_type');
} else {
$query = "SELECT SQL_NO_CACHE
asset_typeID,asset_type FROM asset_types ORDER BY asset_type ASC";
}
return $db->get_menu2('asset_typeID',$query,set_menu_extras
($tab_index,$disabled),false,$tID,false,CACHE);
}
and in the db class
function check_menu_cache($table,$value_field) {
$query = $this->query("SELECT SQL_CACHE cache_data FROM
cache_menu_table WHERE cache_table='$table'");
if ($this->results()) {
$query = "SELECT SQL_CACHE cache_data FROM
cache_menu_table WHERE cache_table='$table'";
} else {
$query = $this->query("SELECT SQL_NO_CACHE * FROM
$table ORDER BY $value_field ASC");
while ($row = $this->fetchArray($query)) {
$arr[$row[0]] = $row[1];
}
$insertID = $this->insert("INSERT INTO
cache_menu_table (cache_data,cache_table) VALUES ('".serialize
($arr)."','$table')");
$query = "SELECT SQL_CACHE cache_data FROM
cache_menu_table WHERE cacheID IN (".$insertID.")";
}
return $query;
}
What is the purpose of mysql_unbuffered_query i just tried it and killed my
connection