Server side optimization Nov 13, 2009
Database result cache
As we know, the database will use many resource and time to query the information of Image. If we want to save time, we could do optimization with cache the result.
What I use is two functions, you could use other PHP cache library too. The code I use is version 1.13.
!! Please note: because I don't open the comment function, so it may have problem with comment.
1. Edit the functions-db.php under zp-core directory.
2. Search function query_single_row, change it to:
function query_single_row($sql){
if ($cache = get_cache($sql))
return $cache; $result = query($sql);
if ($result) {
$singlerow = mysql_fetch_assoc($result);
store_cache($sql, $singlerow);
return $singlerow;
} else {
return false;
}
}
3. Search function query_full_array, change it to:
function query_full_array($sql){
if ($cache = get_cache($sql)) (...)