<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zenphoto - simpler web gallery management &#187; cache</title>
	<atom:link href="http://www.zenphoto.org/tag/cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zenphoto.org</link>
	<description>Blog for news about Zenphoto and its development.</description>
	<lastBuildDate>Fri, 30 Jul 2010 16:45:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Purge Image cache</title>
		<link>http://www.zenphoto.org/2010/05/purge-image-cache/</link>
		<comments>http://www.zenphoto.org/2010/05/purge-image-cache/#comments</comments>
		<pubDate>Thu, 06 May 2010 17:18:39 +0000</pubDate>
		<dc:creator>acrylian</dc:creator>
				<category><![CDATA[Admin utilities]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Officially supported]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://www.zenphoto.org/?p=1572</guid>
		<description><![CDATA[Clears the image cache. Images will be re-cached as they are viewed.
This is a button interface for the admin backend&#8217;s overview page.
]]></description>
			<content:encoded><![CDATA[<p>Clears the image cache. Images will be re-cached as they are viewed.</p>
<p><em>This is a button interface for the admin backend&#8217;s overview page.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenphoto.org/2010/05/purge-image-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Purge RSS cache</title>
		<link>http://www.zenphoto.org/2010/05/purge-rss-cache/</link>
		<comments>http://www.zenphoto.org/2010/05/purge-rss-cache/#comments</comments>
		<pubDate>Thu, 06 May 2010 17:17:48 +0000</pubDate>
		<dc:creator>acrylian</dc:creator>
				<category><![CDATA[Admin utilities]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Officially supported]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://www.zenphoto.org/?p=1571</guid>
		<description><![CDATA[This is a button interface for the admin backend&#8217;s overview page.
]]></description>
			<content:encoded><![CDATA[<p><em>This is a button interface for the admin backend&#8217;s overview page.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenphoto.org/2010/05/purge-rss-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cache_images</title>
		<link>http://www.zenphoto.org/2010/05/cache_images/</link>
		<comments>http://www.zenphoto.org/2010/05/cache_images/#comments</comments>
		<pubDate>Thu, 06 May 2010 16:32:49 +0000</pubDate>
		<dc:creator>acrylian</dc:creator>
				<category><![CDATA[Admin utilities]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Officially supported]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://www.zenphoto.org/?p=1552</guid>
		<description><![CDATA[Developed by Stephen Billard (sbillard)
Finds newly uploaded images that have not been cached and creates the cached version. It also refreshes the numbers above. If you have a large number of images in your gallery you might consider using the pre-cache image link for each album to avoid swamping your browser
]]></description>
			<content:encoded><![CDATA[<p>Developed by Stephen Billard (sbillard)</p>
<p>Finds newly uploaded images that have not been cached and creates the cached version. It also refreshes the numbers above. If you have a large number of images in your gallery you might consider using the pre-cache image link for each album to avoid swamping your browser</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenphoto.org/2010/05/cache_images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>static_html_cache</title>
		<link>http://www.zenphoto.org/2009/11/static_html_cache/</link>
		<comments>http://www.zenphoto.org/2009/11/static_html_cache/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 12:09:16 +0000</pubDate>
		<dc:creator>acrylian</dc:creator>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Officially supported]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Theme plugins]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://www.zenphoto.org/?p=1050</guid>
		<description><![CDATA[Developed by Malte Müller (acrylian) and Stephen Billard (sbillard)
Caches all Zenphoto pages (incl. Zenpage support) except search.php (search results, date archive) and the custom error page 404.php
Usage information
]]></description>
			<content:encoded><![CDATA[<p>Developed by Malte Müller (acrylian) and Stephen Billard (sbillard)</p>
<p>Caches all Zenphoto pages (incl. Zenpage support) except search.php (search results, date archive) and the custom error page 404.php</p>
<p><span class="buttons"><a title="usage information" href="http://www.zenphoto.org/documentation/plugins/_zp-extensions---static_html_cache.php.html">Usage information</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenphoto.org/2009/11/static_html_cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server side optimization</title>
		<link>http://www.zenphoto.org/2009/11/server-side-optimization/</link>
		<comments>http://www.zenphoto.org/2009/11/server-side-optimization/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 20:05:29 +0000</pubDate>
		<dc:creator>acrylian</dc:creator>
				<category><![CDATA[Addons & Utilities]]></category>
		<category><![CDATA[Extensions]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Unsupported]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[PHP cache libary]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.zenphoto.org/?p=944</guid>
		<description><![CDATA[Developed by sagasw
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.
!! [...]]]></description>
			<content:encoded><![CDATA[<p>Developed by <a title="http://henku.info/" href="http://henku.info/">sagasw</a></p>
<p>Database result cache</p>
<p>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.<br />
What I use is two functions, you could use other PHP cache library too. The code I use is version 1.13.<br />
!! Please note: because I don&#8217;t open the comment function, so it may have problem with comment.</p>
<p>You could go to site <tt><a href="http://henku.info/"><span>http://henku.info</span></a></tt> to see the cache result.</p>
<p>1. Edit the functions-db.php under zp-core directory.</p>
<p>2. Search function query_single_row, change it to:<br />
<code>function query_single_row($sql){<br />
if ($cache = get_cache($sql))<br />
return $cache; $result = query($sql);<br />
if ($result) {<br />
$singlerow = mysql_fetch_assoc($result);<br />
store_cache($sql, $singlerow);<br />
return $singlerow;<br />
} else {<br />
return false;<br />
}<br />
}</code><br />
3. Search function query_full_array, change it to:<br />
<code>function query_full_array($sql){<br />
if ($cache = get_cache($sql))<br />
return $cache; $result = query($sql);<br />
if ($result) {<br />
$allrows = array();<br />
while ($row = mysql_fetch_assoc($result))<br />
$allrows[] = $row;<br />
store_cache($sql, $allrows);<br />
return $allrows;<br />
} else {<br />
return false;<br />
}<br />
}</code><br />
4. Last thing, add two functions in functions-db.php. You could change &#8220;cachedirectory&#8221; to your cache directory, and change $cache_time_out to the expire time you want. 30* 24 * 3600 is 30 days.<br />
<code>function store_cache($query, $result_cache){<br />
if (preg_match("/^(insert|delete|update|replace)\s+/i",$query))<br />
return;<br />
if (stristr($query, "ORDER BY RAND"))<br />
return; $cache_file = 'cachedirectory/'. md5($query);<br />
error_log (serialize($result_cache), 3, $cache_file);<br />
}</code><br />
<code><br />
function get_cache($query)<br />
{<br />
$cache_time_out = 30* 24 * 3600;<br />
if (preg_match("/^(insert|delete|update|replace)\s+/i",$query))<br />
return;<br />
if (stristr($query, "ORDER BY RAND"))<br />
return;<br />
$cache_file = 'cachedirectory/'. md5($query);<br />
if ( file_exists($cache_file) )<br />
{<br />
if ( (time() - filemtime($cache_file)) &gt; $cache_time_out )<br />
{<br />
unlink($cache_file);<br />
}<br />
else<br />
{<br />
$result_cache = unserialize(file_get_contents($cache_file));<br />
return $result_cache;<br />
}<br />
}<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zenphoto.org/2009/11/server-side-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
