Enhancing static_html_cache - wongm - 2010-07-22
My gallery currently get a lot of hits, I have turned on the static_html_cache plugin which managed to cut the CPU load quite a bit. Unfortunately it did not do enough, I often post links directly to Zenphoto search results, which makes things easier for users, but flogs the webserver as the pages needs to be created dynamically every time it is viewed.
I have tweaked the static_html_cache plugin so it works for my needs, it looks at the date or words being search for, and uniquely caches the results page as HTML. It handles pagnation, but does not support varied search fields (as I don't give people the option of changing them).
The diff is as follows:
Quote:46c46
< $cachesubfolders = array("index", "albums","images","pages","search");
$cachesubfolders = array("index", "albums","images","pages");
73c73
< setOptionDefault('static_cache_excludedpages', 'contact.php/,register.php/');
setOptionDefault('static_cache_excludedpages', 'search.php/,contact.php/,register.php/');
253,266d252
< // search.php
< if($_zp_gallery_page === "search.php") {
< $cachesubfolder = "search";
< $custompage = $_zp_gallery_page;
< $words = $_REQUEST['words'];
< $date = $_REQUEST['date'];
< if (strlen($words) > 0) {
< $custompage = $words."-".$custompage;
< }
< if (strlen($date) > 0) {
< $custompage = "d".$date."-".$custompage;
< }
< $cachefilepath = $cachesubfolder."/".$custompage.$page.$locale.".html";
< }
268c254
< else if(isset($_GET['p'])) {
if(isset($_GET['p'])) {
299c285
< $cachesubfolders = array("index", "albums","images","pages","search");
$cachesubfolders = array("index", "albums","images","pages");
Enhancing static_html_cache - wongm - 2010-07-22
The filenames of the cached files are as follows...
"Foo"
foo-search.php_1_en_US.html
"Foo" page 2:
foo-search.php_2_en_US.html
Images taken on 2010-07-17:
d2010-07-17-search.php_1_en_US.html
Enhancing static_html_cache - acrylian - 2010-07-22
Please open a ticket and attach a modified version from the current svn/nightly. Then we will take a look for a possible later inclusion. For 1.3.1 it is too late at all as we are already in feature freeze.
|