summaryrefslogtreecommitdiffstats
path: root/user_guide
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-02-05 00:20:34 +0100
committerDerek Allard <derek.allard@ellislab.com>2008-02-05 00:20:34 +0100
commit9b3e7b5f2d4ec4feae793ef90454506addbb19e1 (patch)
tree866d6efe488c04a118cdb015991452e56d1722ec /user_guide
parent613c6f605666031aa5b60c2dca568ac2d3a3c264 (diff)
Added and documented Active Record caching.
Made AR fully database-prefix aware
Diffstat (limited to 'user_guide')
-rw-r--r--user_guide/changelog.html18
-rw-r--r--user_guide/database/active_record.html39
2 files changed, 51 insertions, 6 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 1732e505d..573db864f 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -62,10 +62,24 @@ Change Log
<p>Release Date: -- still in development</p>
<ul>
- <li>Modified xss_clean() to be more intelligent with its handling of URL encoded strings.</li>
-</ul>
+ <li>Active Record
+ <ul>
+ <li>Added <a href="./database/active_record.html#caching">Active Record Caching</a>.</li>
+ <li>Made Active Record fully database-prefix aware</li>
+ </ul>
+ </li>
+ <li>Core Changes
+ <ul>
+ <li>Modified xss_clean() to be more intelligent with its handling of URL encoded strings.</li>
+ </ul>
+ </li>
+ </ul>
+<h3>Bugfixes for 1.6.1</h3>
+<ul>
+ <li> Made Active Record fully database prefix aware (#3384)</li>
+</ul>
<h2>Version 1.6.0</h2>
<p>Release Date: January 30, 2008 </p>
<ul>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 12c59e14b..9a75992fa 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -78,6 +78,7 @@ is generated by each database adapter. It also allows for safer queries, since
<li><a href="#update">Updating Data</a></li>
<li><a href="#delete">Deleting Data</a></li>
<li><a href="#chaining">Method Chaining</a></li>
+<li><a href="#caching">Active Record Caching</a></li>
</ul>
@@ -698,8 +699,8 @@ $this-&gt;db-&gt;truncate('mytable'); <br />
// TRUNCATE mytable <br />
</code>
<p class="important"><strong>Note:</strong> If the TRUNCATE command isn't available, truncate() will execute as &quot;DELETE FROM table&quot;.</p>
-<a name="chaining">&nbsp;</a>
-<h1>Method Chaining</h1>
+
+<h1><a name="chaining">&nbsp;</a>Method Chaining</h1>
<p>Method chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:</p>
@@ -710,8 +711,38 @@ $query = $this->db->get();</code>
<p class="important"><strong>Note:</strong> Method chaining only works with PHP 5.</p>
-
-
+<p>&nbsp;</p>
+
+<h1><a name="caching">&nbsp;</a>Active Record Caching</h1>
+<p>While not &quot;true&quot; caching, Active Record enables you to save (or &quot;cache&quot;) certain parts of your queries for reuse later. Normally, when an Active Record call is completed, all stored information is reset for the next call. With caching, you can prevent this reset, and reuse information easily.</p>
+<p>Cached calls are cumulative.  If you makes 2 cached select() calls, and then 2 uncached select() calls, this will result in 4 select() calls. There are three Caching functions available:</p>
+<h2>$this-&gt;db-&gt;start_cache()</h2>
+<p>This function must be called to begin caching. All Active Record queries of the correct type (see below for supported queries) are stored for later use.</p>
+<h2>$this-&gt;db-&gt;stop_cache()</h2>
+<p>This function can be called to stop caching.</p>
+<h2>$this-&gt;db-&gt;flush_cache()</h2>
+<p>This function deletes all items from the Active Record cache.</p>
+<p>Here's a usage example:</p>
+<p><code> $this-&gt;db-&gt;start_cache();<br />
+ $this-&gt;db-&gt;select('field1');<br />
+ $this-&gt;db-&gt;stop_cache();<br />
+ $this-&gt;db-&gt;get('tablename');<br />
+ // Results in:<br />
+ // SELECT `field1` FROM (`tablename`)<br />
+ <br />
+ this-&gt;db-&gt;select('field2');<br />
+ $this-&gt;db-&gt;get('tablename');<br />
+ // Results in:<br />
+ // SELECT `field1`, `field2` FROM (`tablename`)<br />
+ <br />
+ $this-&gt;db-&gt;flush_cache();<br />
+ <br />
+ this-&gt;db-&gt;select('field2');<br />
+ $this-&gt;db-&gt;get('tablename');<br />
+ // Results in:<br />
+ // SELECT `field2` FROM (`tablename`)</code></p>
+<p class="important"> <strong>Note:</strong> The following fields can be cached: ‘select’, ‘from’, ‘join’, ‘where’, ‘like’, ‘groupby’, ‘having’, ‘orderby’, ‘set’</p>
+<p>&nbsp;</p>
</div>
<!-- END CONTENT -->