summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-05 07:28:07 +0200
committeradmin <devnull@localhost>2006-10-05 07:28:07 +0200
commit930d05220955ef46780a0a868e21224c2f724fd2 (patch)
tree30d2b06dc4862ee2c2912bc87f34ee0e502b6c31
parentf3428b56da5caed3d39438f31fe1b073c3c0e0c0 (diff)
-rw-r--r--user_guide/database/caching.html43
1 files changed, 26 insertions, 17 deletions
diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html
index 0f852cf03..1ee0b19b8 100644
--- a/user_guide/database/caching.html
+++ b/user_guide/database/caching.html
@@ -112,23 +112,32 @@ single answer to the question of whether you should cache your database. It rea
are not.
<code>
-<kbd>$this->db->cache_on();</kbd> // Turns on caching. We assume that you've set up a valid cache foler...
-
-$query = $this->db->query("SELECT * FROM blog LIMIT 10);
-
-foreach ($query->result() as $row)
-{
- echo '<h3>'.$row->title.'</h3>';
- echo '<p>'>.$row->content.'</p>';
-}
-
-
-
-
-
-
-
-
+// Turn OFF caching for this one query since we don't<br />
+// want it to affect any existing cache files<br />
+<kbd>$this->db->cache_off();</kbd><br />
+<br />
+$this->db->query("UPDATE web_stats SET page_views = page_views + 1");<br />
+<br /><br />
+
+// Re-enable caching<br />
+<kbd>$this->db->cache_on();</kbd> <br />
+<br />
+$query = $this->db->query("SELECT * FROM blog LIMIT 10");<br />
+<br />
+foreach ($query->result() as $row)<br />
+{<br />
+ echo '&lt;h3>'.$row->title.'&lt;/h3>';<br />
+ echo '&lt;p>'>.$row->content.'&lt;/p>';<br />
+}<br />
+<br />
+$query = $this->db->query("SELECT page_views FROM web_stats");<br />
+$row = $query->row();<br />
+<br />
+echo '&lt;p>'.$row->page_views.'&lt;/p>';<br />
+<br />
+// Update the web stats, so we turn off caching so that the cache<br />
+// file for the above query doesn't get deleted<br />
+<br />
</code>