<?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: CakePHP: Cache individual queries</title>
	<atom:link href="http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cakephp-cache-individual-queries</link>
	<description>sharing technology, ideas, insights!</description>
	<lastBuildDate>Thu, 02 Feb 2012 08:48:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jason</title>
		<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/comment-page-1/#comment-5904</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Fri, 24 Jun 2011 04:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.sanisoft.com/?p=1193#comment-5904</guid>
		<description>Ok got it.. the code was incomplete..

So inside the if statement-

--------------------------------------------
        $key = $fields[&#039;cache&#039;];
        $expires = &#039;+1 day&#039;;
        $path = null;
        $conf = &#039;sql_cache&#039;;
        
       // required settings $key[&#039;name&#039;] $path[&#039;location&#039;]
        if (is_array($fields[&#039;cache&#039;])) {
          $key = $fields[&#039;cache&#039;][0];
          $path = $fields[&#039;cache&#039;][1];
          
         //optional setting for expiration time
          if (isset($fields[&#039;cache&#039;][2])) {
            $expires = $fields[&#039;cache&#039;][2];
          }
        }
        
        // Set cache settings
        Cache::config($conf, array(
          &#039;prefix&#039; 	=&gt; strtolower($this-&gt;name) .&#039;-&#039;,
          &#039;path&#039; =&gt; CACHE .&#039;sql_queries&#039; . DS . $path,
          &#039;duration&#039;	=&gt; $expires
        ));
----------------------------------------------------------------------

I added $path and kept $expires. I also moved &#039;path&#039; from core config script into the find() function config.

I call it like-
-------------------------------------------------------------------------------
&#039;cache&#039; =&gt; array(&#039;navigation_query&#039;, &#039;layout_folder&#039;, &#039;+1 week&#039;)
-------------------------------------------------------------------------------

Thanks</description>
		<content:encoded><![CDATA[<p>Ok got it.. the code was incomplete..</p>
<p>So inside the if statement-</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
        $key = $fields['cache'];<br />
        $expires = &#8216;+1 day&#8217;;<br />
        $path = null;<br />
        $conf = &#8216;sql_cache&#8217;;</p>
<p>       // required settings $key['name'] $path['location']<br />
        if (is_array($fields['cache'])) {<br />
          $key = $fields['cache'][0];<br />
          $path = $fields['cache'][1];</p>
<p>         //optional setting for expiration time<br />
          if (isset($fields['cache'][2])) {<br />
            $expires = $fields['cache'][2];<br />
          }<br />
        }</p>
<p>        // Set cache settings<br />
        Cache::config($conf, array(<br />
          &#8216;prefix&#8217; 	=&gt; strtolower($this-&gt;name) .&#8217;-',<br />
          &#8216;path&#8217; =&gt; CACHE .&#8217;sql_queries&#8217; . DS . $path,<br />
          &#8216;duration&#8217;	=&gt; $expires<br />
        ));<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>I added $path and kept $expires. I also moved &#8216;path&#8217; from core config script into the find() function config.</p>
<p>I call it like-<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8216;cache&#8217; =&gt; array(&#8216;navigation_query&#8217;, &#8216;layout_folder&#8217;, &#8216;+1 week&#8217;)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/comment-page-1/#comment-5903</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Fri, 24 Jun 2011 00:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.sanisoft.com/?p=1193#comment-5903</guid>
		<description>Hi, I tried modifying milesj code but i never got Folder Path to work- &#039;sql_cache_layout&#039;. 

Also cache key does not accept two parameters using
----------------------------------------
if (isset($fields[&#039;cache&#039;][1])) {
     $conf = $fields[&#039;cache&#039;][1];
 }
----------------------------------------
$conf changed back to $expires allows two parameters but file saves to parent sql_qeries folder.

Thanks.</description>
		<content:encoded><![CDATA[<p>Hi, I tried modifying milesj code but i never got Folder Path to work- &#8216;sql_cache_layout&#8217;. </p>
<p>Also cache key does not accept two parameters using<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
if (isset($fields['cache'][1])) {<br />
     $conf = $fields['cache'][1];<br />
 }<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
$conf changed back to $expires allows two parameters but file saves to parent sql_qeries folder.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Single query cache and pagination cache (until a future post) and ad hoc joins. An over-override of appModel::find : Essemme</title>
		<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/comment-page-1/#comment-4224</link>
		<dc:creator>Single query cache and pagination cache (until a future post) and ad hoc joins. An over-override of appModel::find : Essemme</dc:creator>
		<pubDate>Wed, 29 Sep 2010 10:29:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.sanisoft.com/?p=1193#comment-4224</guid>
		<description>[...] http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries" rel="nofollow">http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya Mooley</title>
		<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/comment-page-1/#comment-3820</link>
		<dc:creator>Aditya Mooley</dc:creator>
		<pubDate>Fri, 02 Jul 2010 12:23:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.sanisoft.com/?p=1193#comment-3820</guid>
		<description>Glad to know that it was useful for you.</description>
		<content:encoded><![CDATA[<p>Glad to know that it was useful for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhimanyu Grover</title>
		<link>http://www.sanisoft.com/blog/2010/06/28/cakephp-cache-individual-queries/comment-page-1/#comment-3819</link>
		<dc:creator>Abhimanyu Grover</dc:creator>
		<pubDate>Fri, 02 Jul 2010 12:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.sanisoft.com/?p=1193#comment-3819</guid>
		<description>Your code has been successfully stolen to our project! :D

Thanks man.</description>
		<content:encoded><![CDATA[<p>Your code has been successfully stolen to our project! <img src='http://www.sanisoft.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Thanks man.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

