![]() |
|
Server side optimization - Database result cache - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Server side optimization - Database result cache (/thread-2059.html) |
Server side optimization - Database result cache - sagasw - 2008-01-11 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. You could go to site http://henku.info to see the cache result. 1, Edit the functions-db.php under zp-core directory. 2, Search function query_single_row, change it to: function query_single_row($sql) $result = query($sql);
} else { 3, Search function query_full_array, change it to: function query_full_array($sql) $result = query($sql);
} else { 4, Last thing, add two functions in functions-db.php. You could change "cachedirectory" to your cache directory, and change $cache_time_out to the expire time you want. 30 24 3600 is 30 days. function store_cache($query, $result_cache)
} function get_cache($query)
} Server side optimization - Database result cache - sbillard - 2008-01-11 The normal albums and images data is cached. The other searches are not frequent enough to warrant caching. |