<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:series="http://organizeseries.com/"
		>
<channel>
	<title>Comments on: Caching For Efficiency With Zend Framework</title>
	<atom:link href="http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=caching-for-efficiency-with-zend-framework</link>
	<description>The personal blog of Brandon Savage. Contains entries of a personal and professional nature focusing on PHP, Apple, LAMP, MySQL and Washington, DC.</description>
	<lastBuildDate>Wed, 15 May 2013 14:54:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2-alpha</generator>
	<item>
		<title>By: Hoang Nguyen</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-4089</link>
		<dc:creator>Hoang Nguyen</dc:creator>
		<pubDate>Tue, 06 Sep 2011 09:53:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-4089</guid>
		<description><![CDATA[Thanks for your useful article,
I tried and get the cache feature to work but the .htaccess rules seems not work.

My url structure is domain.com/cat_name/article_name.html

Cached folder stored the same structure as domain one
-cached
--cat_name
-----article_name.html.html
--cat_name_1
-----article_name_1.html.html

I tried to mess up with htaccess rule but failed. Could you point me anything to make it work ?]]></description>
		<content:encoded><![CDATA[<p>Thanks for your useful article,<br />
I tried and get the cache feature to work but the .htaccess rules seems not work.</p>
<p>My url structure is domain.com/cat_name/article_name.html</p>
<p>Cached folder stored the same structure as domain one<br />
-cached<br />
&#8211;cat_name<br />
&#8212;&#8211;article_name.html.html<br />
&#8211;cat_name_1<br />
&#8212;&#8211;article_name_1.html.html</p>
<p>I tried to mess up with htaccess rule but failed. Could you point me anything to make it work ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan K</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3342</link>
		<dc:creator>Evan K</dc:creator>
		<pubDate>Mon, 19 Apr 2010 03:31:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3342</guid>
		<description><![CDATA[Definitely useful for really simple applications...However, since it relies solely on the REQUEST_URI, I wonder if there&#039;s a way to modify it to work with subdomain-based routing (with a subdomain maps to a module)?  I&#039;ve only started digging into this, but it doesn&#039;t look like it will be an easy thing to get working.]]></description>
		<content:encoded><![CDATA[<p>Definitely useful for really simple applications&#8230;However, since it relies solely on the REQUEST_URI, I wonder if there&#8217;s a way to modify it to work with subdomain-based routing (with a subdomain maps to a module)?  I&#8217;ve only started digging into this, but it doesn&#8217;t look like it will be an easy thing to get working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Cook</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3330</link>
		<dc:creator>Paul Cook</dc:creator>
		<pubDate>Sun, 18 Apr 2010 16:10:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3330</guid>
		<description><![CDATA[Exactly what I needed at the right time.  Thanks, Brandon, for creating a straight forward and frankly dead simple tutorial for static caching.  I had started wading through the docs and some other blog posts on ZF caching and was getting a little worried I was not going to be able to implement what I wanted.  This article saved my day!]]></description>
		<content:encoded><![CDATA[<p>Exactly what I needed at the right time.  Thanks, Brandon, for creating a straight forward and frankly dead simple tutorial for static caching.  I had started wading through the docs and some other blog posts on ZF caching and was getting a little worried I was not going to be able to implement what I wanted.  This article saved my day!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: holo</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3205</link>
		<dc:creator>holo</dc:creator>
		<pubDate>Wed, 07 Apr 2010 20:13:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3205</guid>
		<description><![CDATA[Thank you for another great post. The rewrite rules work fine in .htaccess file but not when in a virtual host.

Cheers
holo]]></description>
		<content:encoded><![CDATA[<p>Thank you for another great post. The rewrite rules work fine in .htaccess file but not when in a virtual host.</p>
<p>Cheers<br />
holo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac McGowan</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3203</link>
		<dc:creator>Isaac McGowan</dc:creator>
		<pubDate>Wed, 07 Apr 2010 17:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3203</guid>
		<description><![CDATA[I ran into an issue with the rewrite rules and urls that end in a slash.  For example:

http://www.somedomain.com/action/controller/param/param/

In this case the trailing slash causes the rewrite condition that checks for the existence of a cached file to fail.  I fixed this by adding the following before the rule that rewrites to the cached file.

RewriteRule ^(.*)/$ $1 [NC,L]

Some may suggest that this should be a redirect instead, but I decided to use the NC because I like my urls to contain a trailing slash.

Again, thank you Brandon for this post, and thank you to Pádraic for an awesome addition to ZF.]]></description>
		<content:encoded><![CDATA[<p>I ran into an issue with the rewrite rules and urls that end in a slash.  For example:</p>
<p><a href="http://www.somedomain.com/action/controller/param/param/" rel="nofollow">http://www.somedomain.com/action/controller/param/param/</a></p>
<p>In this case the trailing slash causes the rewrite condition that checks for the existence of a cached file to fail.  I fixed this by adding the following before the rule that rewrites to the cached file.</p>
<p>RewriteRule ^(.*)/$ $1 [NC,L]</p>
<p>Some may suggest that this should be a redirect instead, but I decided to use the NC because I like my urls to contain a trailing slash.</p>
<p>Again, thank you Brandon for this post, and thank you to Pádraic for an awesome addition to ZF.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Thompson</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3199</link>
		<dc:creator>Andy Thompson</dc:creator>
		<pubDate>Wed, 07 Apr 2010 07:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3199</guid>
		<description><![CDATA[Thanks Pádraic and thanks Brandon for the great post.

Its been a while since I&#039;ve looked into page caching, and I had moved on to using frontend content servers (Nginx and mpm-worker with mod_cache) for caching.

Maybe I&#039;ll finish the issue (ZF-3078) I opened regarding bringing Cache-Control functionalitiy to the Page cache.]]></description>
		<content:encoded><![CDATA[<p>Thanks Pádraic and thanks Brandon for the great post.</p>
<p>Its been a while since I&#8217;ve looked into page caching, and I had moved on to using frontend content servers (Nginx and mpm-worker with mod_cache) for caching.</p>
<p>Maybe I&#8217;ll finish the issue (ZF-3078) I opened regarding bringing Cache-Control functionalitiy to the Page cache.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac McGowan</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3196</link>
		<dc:creator>Isaac McGowan</dc:creator>
		<pubDate>Wed, 07 Apr 2010 00:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3196</guid>
		<description><![CDATA[Thank you, thank you.  I spent a number of hours trying to get this to work, before calling it quits.  This is a great feature, and I&#039;m happy it&#039;s part of the framework now.  That said, it&#039;s too bad the team couldn&#039;t document it in an intelligible way before including it.

Good job going to the source for information that no one could have gleaned from the documentation.]]></description>
		<content:encoded><![CDATA[<p>Thank you, thank you.  I spent a number of hours trying to get this to work, before calling it quits.  This is a great feature, and I&#8217;m happy it&#8217;s part of the framework now.  That said, it&#8217;s too bad the team couldn&#8217;t document it in an intelligible way before including it.</p>
<p>Good job going to the source for information that no one could have gleaned from the documentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pádraic Brady</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3195</link>
		<dc:creator>Pádraic Brady</dc:creator>
		<pubDate>Wed, 07 Apr 2010 00:10:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3195</guid>
		<description><![CDATA[@Andy: I&#039;ll look into adding the cancel mechanism during the next iteration

@Eric: Cache lifetime is largely irrelevant since a static cache &quot;hit&quot; will bypass PHP entirely. Therein lies it&#039;s great advantage, and great disadvantage (no auto-expiry). If you need to time expiration, you can use a cron task to monitor collections of static files based on their cached tag references and modification times.

@Mary: There&#039;s a few ways of keeping cleaning efficient. Specific tagging (avoiding generalised tagging) can keep a tidier breakdown of the cache in the first place, esp. between time sensitive caches (must be cleaned almost immediately if data alters) and time insensitive caches (cleaning can be deferred to a cron process).

Another tip (with some extra coding), depending on your setup, is that in some scenarios you can take advantage of a light web server (e.g. Nginx) which can interact with memcached. Not all &quot;static&quot; caches need be stored to files though it&#039;s the most common need on single server apps. Whenever Zend_Cache is refactored for ZF 2.0, and we have some cleanly defined interfaces (static caching uses a couple of &quot;workarounds&quot; which is why it seems odd when using it outside of the cache action helper), it&#039;s something I&#039;ll look into porting in directly for support.

Thanks to Brandon for the light shedding article! Great one, as usual.]]></description>
		<content:encoded><![CDATA[<p>@Andy: I&#8217;ll look into adding the cancel mechanism during the next iteration</p>
<p>@Eric: Cache lifetime is largely irrelevant since a static cache &#8220;hit&#8221; will bypass PHP entirely. Therein lies it&#8217;s great advantage, and great disadvantage (no auto-expiry). If you need to time expiration, you can use a cron task to monitor collections of static files based on their cached tag references and modification times.</p>
<p>@Mary: There&#8217;s a few ways of keeping cleaning efficient. Specific tagging (avoiding generalised tagging) can keep a tidier breakdown of the cache in the first place, esp. between time sensitive caches (must be cleaned almost immediately if data alters) and time insensitive caches (cleaning can be deferred to a cron process).</p>
<p>Another tip (with some extra coding), depending on your setup, is that in some scenarios you can take advantage of a light web server (e.g. Nginx) which can interact with memcached. Not all &#8220;static&#8221; caches need be stored to files though it&#8217;s the most common need on single server apps. Whenever Zend_Cache is refactored for ZF 2.0, and we have some cleanly defined interfaces (static caching uses a couple of &#8220;workarounds&#8221; which is why it seems odd when using it outside of the cache action helper), it&#8217;s something I&#8217;ll look into porting in directly for support.</p>
<p>Thanks to Brandon for the light shedding article! Great one, as usual.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3194</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 06 Apr 2010 23:17:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3194</guid>
		<description><![CDATA[To add to what you said, Joe, I&#039;m not 100% sure that this cache even has an expiration time. Since the files are static, and meant to be cached until expired, this may not be an issue.]]></description>
		<content:encoded><![CDATA[<p>To add to what you said, Joe, I&#8217;m not 100% sure that this cache even has an expiration time. Since the files are static, and meant to be cached until expired, this may not be an issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Devon</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3191</link>
		<dc:creator>Joe Devon</dc:creator>
		<pubDate>Tue, 06 Apr 2010 22:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3191</guid>
		<description><![CDATA[Nice article Brandon. Paddy&#039;s new code sounds like a nice addition. Hadn&#039;t had a chance to try it out yet...

Mary, what I do is set very high, basically unlimited expire times, then prime the cache via cron, which overwrites cache files instead of dealing w/ cleaning out expiring caches.]]></description>
		<content:encoded><![CDATA[<p>Nice article Brandon. Paddy&#8217;s new code sounds like a nice addition. Hadn&#8217;t had a chance to try it out yet&#8230;</p>
<p>Mary, what I do is set very high, basically unlimited expire times, then prime the cache via cron, which overwrites cache files instead of dealing w/ cleaning out expiring caches.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Thompson</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3186</link>
		<dc:creator>Andy Thompson</dc:creator>
		<pubDate>Tue, 06 Apr 2010 12:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3186</guid>
		<description><![CDATA[There is a very big flaw in Zend&#039;s Page cache class, which I reported to them and we came up with a workaround.

http://framework.zend.com/issues/browse/ZF-3076

It must not be used to cache a HTTP redirect or under any error condition as it cannot know the HTTP status that was sent, and essentially means any page is cached, and later served as HTTP 200 OK.

The workaround is to call the $cache-&gt;cancel() on these conditions manually.

However I&#039;ve not delved deep into the new cache helper, I can&#039;t see any explicit code that handles these conditions.]]></description>
		<content:encoded><![CDATA[<p>There is a very big flaw in Zend&#8217;s Page cache class, which I reported to them and we came up with a workaround.</p>
<p><a href="http://framework.zend.com/issues/browse/ZF-3076" rel="nofollow">http://framework.zend.com/issues/browse/ZF-3076</a></p>
<p>It must not be used to cache a HTTP redirect or under any error condition as it cannot know the HTTP status that was sent, and essentially means any page is cached, and later served as HTTP 200 OK.</p>
<p>The workaround is to call the $cache-&gt;cancel() on these conditions manually.</p>
<p>However I&#8217;ve not delved deep into the new cache helper, I can&#8217;t see any explicit code that handles these conditions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3185</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 06 Apr 2010 11:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3185</guid>
		<description><![CDATA[Nice post. Thanks for all the info.

I&#039;ve tryied on my web page but still have a problem, do you know if there is any way to change the cache lifetime for a specific action?

Thanks.]]></description>
		<content:encoded><![CDATA[<p>Nice post. Thanks for all the info.</p>
<p>I&#8217;ve tryied on my web page but still have a problem, do you know if there is any way to change the cache lifetime for a specific action?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3183</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Tue, 06 Apr 2010 07:47:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3183</guid>
		<description><![CDATA[Thanks for this great post! I don&#039;t know about this two new features yet, I&#039;m looking forward to test it in some of my projects soon. Thanks again!]]></description>
		<content:encoded><![CDATA[<p>Thanks for this great post! I don&#8217;t know about this two new features yet, I&#8217;m looking forward to test it in some of my projects soon. Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mary Nicole Hicks</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3181</link>
		<dc:creator>Mary Nicole Hicks</dc:creator>
		<pubDate>Tue, 06 Apr 2010 03:24:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3181</guid>
		<description><![CDATA[You say that &quot;Occasionally you may wish to invalidate the cache and remove old files. To do so, you search by tag&quot;. This reminded me about a problem I had with cleaning the cache.

Cleaning up static caches has been a problem for me. Watch out for the automated &quot;cleans&quot; that the cache system will do every so many cache requests. If you have pages that expire, these will all require disk access. Now that you have cached lots of your requests, cleans do not happen as often. When a clean occurs it will slow down the request dramatically. The problem with this is that you will not notice for a while as it does not slow down every request. Only ones when the cleans randomly(?) occur.

You are better off disabling the Zend_Cache cleaning mechanism and scripting it into a cron job that executes it on your website&#039;s quiet times.

I am sure with some profiling you will see what I mean. That or if have lots of static cache pages, expire your static cache pages and are on a shared webhost, look for the timeouts in your log files.

Also if Google bot can access your static cache pages, it will crawl them all one after another, just to make sure that they all expire at the same time.]]></description>
		<content:encoded><![CDATA[<p>You say that &#8220;Occasionally you may wish to invalidate the cache and remove old files. To do so, you search by tag&#8221;. This reminded me about a problem I had with cleaning the cache.</p>
<p>Cleaning up static caches has been a problem for me. Watch out for the automated &#8220;cleans&#8221; that the cache system will do every so many cache requests. If you have pages that expire, these will all require disk access. Now that you have cached lots of your requests, cleans do not happen as often. When a clean occurs it will slow down the request dramatically. The problem with this is that you will not notice for a while as it does not slow down every request. Only ones when the cleans randomly(?) occur.</p>
<p>You are better off disabling the Zend_Cache cleaning mechanism and scripting it into a cron job that executes it on your website&#8217;s quiet times.</p>
<p>I am sure with some profiling you will see what I mean. That or if have lots of static cache pages, expire your static cache pages and are on a shared webhost, look for the timeouts in your log files.</p>
<p>Also if Google bot can access your static cache pages, it will crawl them all one after another, just to make sure that they all expire at the same time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James S</title>
		<link>http://www.brandonsavage.net/caching-for-efficiency-with-zend-framework/#comment-3180</link>
		<dc:creator>James S</dc:creator>
		<pubDate>Tue, 06 Apr 2010 01:52:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=1242#comment-3180</guid>
		<description><![CDATA[Another optimization worth noting is if you&#039;re using Zend_Db, you can use the following line to cache table metadata:

Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);

Where $cache is your factory-generated cache object.]]></description>
		<content:encoded><![CDATA[<p>Another optimization worth noting is if you&#8217;re using Zend_Db, you can use the following line to cache table metadata:</p>
<p>Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);</p>
<p>Where $cache is your factory-generated cache object.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced (User agent is rejected)
Object Caching 642/659 objects using apc
Content Delivery Network via Amazon Web Services: S3: brandonsavage-net-files.s3.amazonaws.com

 Served from: www.brandonsavage.net @ 2013-05-18 18:51:25 by W3 Total Cache -->