<?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/"
		>
<channel>
	<title>Comments on: Caching using PHP/Zend_Cache and MySQL</title>
	<atom:link href="http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/</link>
	<description>Blogging about PHP, Actionscript, MySQL, and other interests.</description>
	<lastBuildDate>Thu, 11 Mar 2010 06:56:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joey</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-163</link>
		<dc:creator>Joey</dc:creator>
		<pubDate>Fri, 29 Jan 2010 21:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-163</guid>
		<description>Here is a new post on how I use Zend_Paginator and Zend_Cache:

http://www.joeyrivera.com/2010/using-zend_paginator-with-twitter-api-and-zend_cache/</description>
		<content:encoded><![CDATA[<p>Here is a new post on how I use Zend_Paginator and Zend_Cache:</p>
<p><a href="http://www.joeyrivera.com/2010/using-zend_paginator-with-twitter-api-and-zend_cache/" rel="nofollow">http://www.joeyrivera.com/2010/using-zend_paginator-with-twitter-api-and-zend_cache/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joey</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-148</link>
		<dc:creator>Joey</dc:creator>
		<pubDate>Thu, 28 Jan 2010 14:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-148</guid>
		<description>I think I may create a quick blog post today about using Zend_Paginator and caching for reference. The only thing I notice in your code is 

Zend_Paginator::factory($q-&gt;fetchAll());

Have you tried adding -&gt;toArray() at the end of that to store the actual array and not recordset.

Zend_Paginator::factory($q-&gt;fetchAll()-&gt;toArray());

I haven&#039;t tried the Zend_Paginator::setCache() options before, I&#039;ll try it out later today and see how it goes.</description>
		<content:encoded><![CDATA[<p>I think I may create a quick blog post today about using Zend_Paginator and caching for reference. The only thing I notice in your code is </p>
<p>Zend_Paginator::factory($q->fetchAll());</p>
<p>Have you tried adding ->toArray() at the end of that to store the actual array and not recordset.</p>
<p>Zend_Paginator::factory($q->fetchAll()->toArray());</p>
<p>I haven&#8217;t tried the Zend_Paginator::setCache() options before, I&#8217;ll try it out later today and see how it goes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: asinan</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-146</link>
		<dc:creator>asinan</dc:creator>
		<pubDate>Thu, 28 Jan 2010 10:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-146</guid>
		<description>Hi,

Zend_Paginator and cache. How can I read the datas that I have sent to cache

I register the data to cache and I see the foliowing :
zend_cache---Zend_Paginator_1_42242d5fa3c4e4b7758810c276163e8a

but I can&#039;t read.

$request = $this-&gt;getRequest();
 $q = new Model();
 $paginator = Zend_Paginator::factory($q-&gt;fetchAll());
 $paginator-&gt;setCurrentPageNumber($request-&gt;getParam(&#039;p&#039;)); 
 $paginator-&gt;setItemCountPerPage(40);
 $this-&gt;view-&gt;q = $paginator;

 $fO = array(&#039;lifetime&#039; =&gt; 3600, &#039;automatic_serialization&#039; =&gt; true);
 $bO = array(&#039;cache_dir&#039;=&gt; APPLICATION_PATH . &#039;/cache/&#039;);
 $cache = Zend_cache::factory(&#039;Core&#039;, &#039;File&#039;, $fO, $bO);
 Zend_Paginator::setCache($cache);</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Zend_Paginator and cache. How can I read the datas that I have sent to cache</p>
<p>I register the data to cache and I see the foliowing :<br />
zend_cache&#8212;Zend_Paginator_1_42242d5fa3c4e4b7758810c276163e8a</p>
<p>but I can&#8217;t read.</p>
<p>$request = $this-&gt;getRequest();<br />
 $q = new Model();<br />
 $paginator = Zend_Paginator::factory($q-&gt;fetchAll());<br />
 $paginator-&gt;setCurrentPageNumber($request-&gt;getParam(&#8216;p&#8217;));<br />
 $paginator-&gt;setItemCountPerPage(40);<br />
 $this-&gt;view-&gt;q = $paginator;</p>
<p> $fO = array(&#8216;lifetime&#8217; =&gt; 3600, &#8216;automatic_serialization&#8217; =&gt; true);<br />
 $bO = array(&#8216;cache_dir&#8217;=&gt; APPLICATION_PATH . &#8216;/cache/&#8217;);<br />
 $cache = Zend_cache::factory(&#8216;Core&#8217;, &#8216;File&#8217;, $fO, $bO);<br />
 Zend_Paginator::setCache($cache);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joey Rivera</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-113</link>
		<dc:creator>Joey Rivera</dc:creator>
		<pubDate>Fri, 15 Jan 2010 15:25:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-113</guid>
		<description>Eric,

If your plan is to cache the entire page I would do it as early on as possible, maybe even in the bootstrap after you initialize Zend_Cache. At this point, Zend_Cache would already know everything it needs to know to check if the page is cached, which is the url.

Depending on your needs, there may not be any benefit of doing this in the controller nor in the view since it&#039;s just more processing/time the server has to spend when the page might already be cached.</description>
		<content:encoded><![CDATA[<p>Eric,</p>
<p>If your plan is to cache the entire page I would do it as early on as possible, maybe even in the bootstrap after you initialize Zend_Cache. At this point, Zend_Cache would already know everything it needs to know to check if the page is cached, which is the url.</p>
<p>Depending on your needs, there may not be any benefit of doing this in the controller nor in the view since it&#8217;s just more processing/time the server has to spend when the page might already be cached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-112</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Fri, 15 Jan 2010 13:33:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-112</guid>
		<description>Great article, thanks!
For use in the Zend Framework, where would I put the code to cache the entire page? In the view or controller?
thanks</description>
		<content:encoded><![CDATA[<p>Great article, thanks!<br />
For use in the Zend Framework, where would I put the code to cache the entire page? In the view or controller?<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zend Page Cache not working - Zend Framework Forum</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-111</link>
		<dc:creator>Zend Page Cache not working - Zend Framework Forum</dc:creator>
		<pubDate>Mon, 21 Dec 2009 23:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-111</guid>
		<description>[...]  // $cache-&gt;remove(&#039;main&#039;); $cache-&gt;start();  // Zend_Registry::set(&#039;cache&#039;, $cache); }    Joey Rivera Blog Archive Caching using PHP/Zend_Cache and MySQL  Thanks Joey  [...]</description>
		<content:encoded><![CDATA[<p>[...]  // $cache-&gt;remove(&#8216;main&#8217;); $cache-&gt;start();  // Zend_Registry::set(&#8216;cache&#8217;, $cache); }    Joey Rivera Blog Archive Caching using PHP/Zend_Cache and MySQL  Thanks Joey  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enhance performance with Zend_Cache &#124; ChrisRenner.com</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-110</link>
		<dc:creator>Enhance performance with Zend_Cache &#124; ChrisRenner.com</dc:creator>
		<pubDate>Fri, 18 Dec 2009 03:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-110</guid>
		<description>[...] Rivera: Caching using PHP/Zend_Cache and MySQL  &#124;  &#124;  &#124;  &#124;  &#124;  [...]</description>
		<content:encoded><![CDATA[<p>[...] Rivera: Caching using PHP/Zend_Cache and MySQL  |  |  |  |  |  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joey Rivera</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-109</link>
		<dc:creator>Joey Rivera</dc:creator>
		<pubDate>Thu, 03 Dec 2009 18:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-109</guid>
		<description>ag, interestingly enough, I just tried my example and it&#039;s not working for me. I don&#039;t know what&#039;s changed on my environment from when I wrote this post to today but here is what I tried and worked for me. I set all the default_options for Page to true and one of them fixed it so my example now works again. Here is the doc:

http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page

Here is what I did:

$frontendOptions = array(
   &#039;lifetime&#039; =&gt; 10,
   &#039;automatic_serialization&#039; =&gt; true,
	&#039;default_options&#039; =&gt; array(
		&#039;cache_with_get_variables&#039; =&gt; true,
		&#039;cache_with_post_variables&#039; =&gt; true,
		&#039;cache_with_session_variables&#039; =&gt; true,
		&#039;cache_with_files_variables&#039; =&gt; true,
		&#039;cache_with_cookie_variables&#039; =&gt; true,
		&#039;make_id_with_get_variables&#039; =&gt; true,
		&#039;make_id_with_post_variables&#039; =&gt; true,
		&#039;make_id_with_session_variables&#039; =&gt; true,
		&#039;make_id_with_files_variables&#039; =&gt; true,
		&#039;make_id_with_cookie_variables&#039; =&gt; true
	)
);

I probably don&#039;t need all that but at the moment I don&#039;t have time to test which fixed my problem or why I&#039;m having this problem when it worked before. Let me know if this fixes your problem.</description>
		<content:encoded><![CDATA[<p>ag, interestingly enough, I just tried my example and it&#8217;s not working for me. I don&#8217;t know what&#8217;s changed on my environment from when I wrote this post to today but here is what I tried and worked for me. I set all the default_options for Page to true and one of them fixed it so my example now works again. Here is the doc:</p>
<p><a href="http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page" rel="nofollow">http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.page</a></p>
<p>Here is what I did:</p>
<p>$frontendOptions = array(<br />
   &#8216;lifetime&#8217; => 10,<br />
   &#8216;automatic_serialization&#8217; => true,<br />
	&#8216;default_options&#8217; => array(<br />
		&#8216;cache_with_get_variables&#8217; => true,<br />
		&#8216;cache_with_post_variables&#8217; => true,<br />
		&#8216;cache_with_session_variables&#8217; => true,<br />
		&#8216;cache_with_files_variables&#8217; => true,<br />
		&#8216;cache_with_cookie_variables&#8217; => true,<br />
		&#8216;make_id_with_get_variables&#8217; => true,<br />
		&#8216;make_id_with_post_variables&#8217; => true,<br />
		&#8216;make_id_with_session_variables&#8217; => true,<br />
		&#8216;make_id_with_files_variables&#8217; => true,<br />
		&#8216;make_id_with_cookie_variables&#8217; => true<br />
	)<br />
);</p>
<p>I probably don&#8217;t need all that but at the moment I don&#8217;t have time to test which fixed my problem or why I&#8217;m having this problem when it worked before. Let me know if this fixes your problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ag</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-108</link>
		<dc:creator>ag</dc:creator>
		<pubDate>Wed, 02 Dec 2009 22:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-108</guid>
		<description>I&#039;m having problems with Zend_Cache_Page, the same as the other persons in this forum:

http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/zend-page-cache-not-working-3751.html

When I use Core with File or Memcache all works very well for me. But when I use Page I can&#039;t get see the expected results.</description>
		<content:encoded><![CDATA[<p>I&#8217;m having problems with Zend_Cache_Page, the same as the other persons in this forum:</p>
<p><a href="http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/zend-page-cache-not-working-3751.html" rel="nofollow">http://www.zfforums.com/zend-framework-components-13/core-infrastructure-19/zend-page-cache-not-working-3751.html</a></p>
<p>When I use Core with File or Memcache all works very well for me. But when I use Page I can&#8217;t get see the expected results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julius Beckmann</title>
		<link>http://www.joeyrivera.com/2009/caching-using-phpzend_cache-and-mysql/comment-page-1/#comment-107</link>
		<dc:creator>Julius Beckmann</dc:creator>
		<pubDate>Mon, 23 Nov 2009 06:08:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.joeyrivera.com/?p=443#comment-107</guid>
		<description>Hi Joey,

nice article. I just need to add one point:
You are using &quot;File&quot; cache for demonstration. This is great but is not useful in big productive environments. And a server that uses filecache has an IO overhead which is never good.

Using a RAM cache like Memcache that can be easily used on multiple servers would be he way better option if you plan to create a high traffic site.</description>
		<content:encoded><![CDATA[<p>Hi Joey,</p>
<p>nice article. I just need to add one point:<br />
You are using &#8220;File&#8221; cache for demonstration. This is great but is not useful in big productive environments. And a server that uses filecache has an IO overhead which is never good.</p>
<p>Using a RAM cache like Memcache that can be easily used on multiple servers would be he way better option if you plan to create a high traffic site.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
