From f3428b56da5caed3d39438f31fe1b073c3c0e0c0 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 5 Oct 2006 05:19:15 +0000 Subject: --- user_guide/database/caching.html | 48 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'user_guide/database') 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.

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.

@@ -106,6 +106,48 @@ single answer to the question of whether you should cache your database. It rea +

Caching Example

+ +

Here is an example showing how you can selectively cache some queries and not others. Notice that the "write" type queries +are not. + + +$this->db->cache_on(); // 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 '

'.$row->title.'

'; + echo '

'>.$row->content.'

'; +} + + + + + + + + + +
+ + + + + + + + + + + + + + + + + -- cgit v1.2.3-24-g4f1b