summaryrefslogtreecommitdiffstats
path: root/user_guide/database/caching.html
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-05 07:19:15 +0200
committeradmin <devnull@localhost>2006-10-05 07:19:15 +0200
commitf3428b56da5caed3d39438f31fe1b073c3c0e0c0 (patch)
tree2d7a906e0fd4ad93fc30ab0033564bb2754376cb /user_guide/database/caching.html
parent11c06c76e7a166228ef045c4d13c196bf964bd63 (diff)
Diffstat (limited to 'user_guide/database/caching.html')
-rw-r--r--user_guide/database/caching.html48
1 files changed, 45 insertions, 3 deletions
diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html
index 332efb615..0f852cf03 100644
--- a/user_guide/database/caching.html
+++ b/user_guide/database/caching.html
@@ -78,9 +78,9 @@ rather then accessing your database. In other words, the first time a page is lo
The next time the page is loaded the cached file will be used.</p>
<p>When a "write" type query (INSERT, UPDATE, etc.) is run , any cache files associated with the particular page being viewed
-will be deleted automatically. In some cases you may need to update some data with every page load (user stats, for example).
-In these cases you'll proabably want to manually disable caching just before running your "write" query, then re-enable it just
-after. Otherwise, your site will be caught ina cycle of writing/deleting caches, creating more load then if you were not using
+will be deleted automatically. If you need to update some data with every page load (user stats, for example) you will
+need to manually disable caching just before running your "write" query, then re-enable it just
+after. Otherwise, your site will be caught in a cycle of writing/deleting caches with every page view, creating more load then if you were not using
caching. More information on this will be found below.</p>
@@ -106,6 +106,48 @@ single answer to the question of whether you should cache your database. It rea
</ul>
+<h2>Caching Example</h2>
+
+<p>Here is an example showing how you can selectively cache some queries and not others. Notice that the "write" type queries
+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>';
+}
+
+
+
+
+
+
+
+
+
+</code>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
</div>