Member
Member
wongm   22-07-2010, 10:35
#1

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
< &#36;cachesubfolders = array("index", "albums","images","pages","search");


&#36;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(&#36;_zp_gallery_page === "search.php") {
< &#36;cachesubfolder = "search";
< &#36;custompage = &#36;_zp_gallery_page;
< &#36;words = &#36;_REQUEST['words'];
< &#36;date = &#36;_REQUEST['date'];
< if (strlen(&#36;words) > 0) {
< &#36;custompage = &#36;words."-".&#36;custompage;
< }
< if (strlen(&#36;date) > 0) {
< &#36;custompage = "d".&#36;date."-".&#36;custompage;
< }
< &#36;cachefilepath = &#36;cachesubfolder."/".&#36;custompage.&#36;page.&#36;locale.".html";
< }
268c254
< else if(isset(&#36;_GET['p'])) {


  if(isset(&#36;_GET['p'])) {

299c285
< &#36;cachesubfolders = array("index", "albums","images","pages","search");


  &#36;cachesubfolders = array("index", "albums","images","pages");
Member
Member
wongm   22-07-2010, 10:39
#2

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

Administrator
Administrator
acrylian   22-07-2010, 10:42
#3

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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.