summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/general/caching.rst
diff options
context:
space:
mode:
authorKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 21:43:25 +0200
committerKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 21:43:25 +0200
commitad17f4b932b3728c1e299b48f28b3ae0dbdd6b0b (patch)
treefdb357433e76000bdef60c4d18e5ab0540b07aeb /user_guide_src/source/general/caching.rst
parentdb46d02ac23b8e0bc2416e197494d3b795b57530 (diff)
parenta2125a5d830fd390b4cf35f77e9bb0558cfa2dd7 (diff)
Merged with development
Diffstat (limited to 'user_guide_src/source/general/caching.rst')
-rw-r--r--user_guide_src/source/general/caching.rst58
1 files changed, 58 insertions, 0 deletions
diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst
new file mode 100644
index 000000000..bf6ed50f6
--- /dev/null
+++ b/user_guide_src/source/general/caching.rst
@@ -0,0 +1,58 @@
+################
+Web Page Caching
+################
+
+CodeIgniter lets you cache your pages in order to achieve maximum
+performance.
+
+Although CodeIgniter is quite fast, the amount of dynamic information
+you display in your pages will correlate directly to the server
+resources, memory, and processing cycles utilized, which affect your
+page load speeds. By caching your pages, since they are saved in their
+fully rendered state, you can achieve performance that nears that of
+static web pages.
+
+How Does Caching Work?
+======================
+
+Caching can be enabled on a per-page basis, and you can set the length
+of time that a page should remain cached before being refreshed. When a
+page is loaded for the first time, the cache file will be written to
+your application/cache folder. On subsequent page loads the cache file
+will be retrieved and sent to the requesting user's browser. If it has
+expired, it will be deleted and refreshed before being sent to the
+browser.
+
+Note: The Benchmark tag is not cached so you can still view your page
+load speed when caching is enabled.
+
+Enabling Caching
+================
+
+To enable caching, put the following tag in any of your controller
+functions::
+
+ $this->output->cache(n);
+
+Where n is the number of **minutes** you wish the page to remain cached
+between refreshes.
+
+The above tag can go anywhere within a function. It is not affected by
+the order that it appears, so place it wherever it seems most logical to
+you. Once the tag is in place, your pages will begin being cached.
+
+.. important:: Because of the way CodeIgniter stores content for output,
+ caching will only work if you are generating display for your controller
+ with a :doc:`view <./views>`.
+
+.. note:: Before the cache files can be written you must set the file
+ permissions on your application/cache folder such that it is writable.
+
+Deleting Caches
+===============
+
+If you no longer wish to cache a file you can remove the caching tag and
+it will no longer be refreshed when it expires. Note: Removing the tag
+will not delete the cache immediately. It will have to expire normally.
+If you need to remove it earlier you will need to manually delete it
+from your cache folder.