summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-26 13:42:29 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-26 13:42:29 +0200
commit58c2b10eff196d6e7e4c678a3d7ef13bbc030124 (patch)
treecdbd1a2d5a265e165f765b9422cc9fb6c7bbad66 /user_guide_src/source/libraries
parentb05f506daba5dc954fc8bcae76b4a5f97a7433c1 (diff)
Implement cache key prefixing (as suggested in #1197) and update the Cache docs
Diffstat (limited to 'user_guide_src/source/libraries')
-rw-r--r--user_guide_src/source/libraries/caching.rst57
1 files changed, 48 insertions, 9 deletions
diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst
index 2f06d29f9..8d7b4c440 100644
--- a/user_guide_src/source/libraries/caching.rst
+++ b/user_guide_src/source/libraries/caching.rst
@@ -32,6 +32,17 @@ available in the hosting environment.
echo $foo;
+You can also prefix cache item names via the **key_prefix** setting, which is useful
+to avoid collisions when you're running multiple applications on the same environment.
+
+::
+
+ $this->load->driver('cache',
+ array('adapter' => 'apc', 'backup' => 'file', 'key_prefix' => 'my_')
+ );
+
+ $this->cache->get('foo'); // Will get the cache entry named 'my_foo'
+
******************
Function Reference
******************
@@ -39,7 +50,7 @@ Function Reference
.. php:class:: CI_Cache
is_supported()
-===============
+==============
.. php:method:: is_supported ( $driver )
@@ -130,7 +141,7 @@ clean()
$this->cache->clean();
cache_info()
-=============
+============
.. php:method:: cache_info ( )
@@ -148,7 +159,7 @@ cache_info()
get_metadata()
-===============
+==============
.. php:method:: get_metadata ( $id )
@@ -166,7 +177,6 @@ get_metadata()
.. note:: The information returned and the structure of the data is dependent
on which adapter is being used.
-
*******
Drivers
*******
@@ -181,7 +191,7 @@ specific adapter to the driver loader as follows::
$this->cache->apc->save('foo', 'bar', 10);
For more information on APC, please see
-`http://php.net/apc <http://php.net/apc>`_
+`http://php.net/apc <http://php.net/apc>`_.
File-based Caching
==================
@@ -201,20 +211,49 @@ Memcached Caching
=================
Multiple Memcached servers can be specified in the memcached.php
-configuration file, located in the application/config/ directory.
+configuration file, located in the _application/config/* directory.
-All of the functions listed above can be accessed without passing a
+All of the methods listed above can be accessed without passing a
specific adapter to the driver loader as follows::
$this->load->driver('cache');
$this->cache->memcached->save('foo', 'bar', 10);
For more information on Memcached, please see
-`http://php.net/memcached <http://php.net/memcached>`_
+`http://php.net/memcached <http://php.net/memcached>`_.
+
+WinCache Caching
+================
+
+Under Windows, you can also utilize the WinCache driver.
+
+All of the functions listed above can be accessed without passing a
+specific adapter to the driver loader as follows::
+
+ $this->load->driver('cache');
+ $this->cache->wincache->save('foo', 'bar', 10);
+
+For more information on WinCache, please see
+`http://php.net/wincache <http://php.net/wincache>`_.
+
+Redis Caching
+=============
+
+All of the methods listed above can be accessed without passing a
+specific adapter to the driver loader as follows::
+
+ $this->load->driver('cache');
+ $this->cache->redis->save('foo', 'bar', 10);
+
+.. important:: Redis may require one or more of the following options:
+ **host**, **post**, **timeout**, **password**.
+
+The Redis PHP extension repository is located at
+`https://github.com/nicolasff/phpredis <https://github.com/nicolasff/phpredis>`_.
Dummy Cache
===========
This is a caching backend that will always 'miss.' It stores no data,
but lets you keep your caching code in place in environments that don't
-support your chosen cache.
+support your chosen cache. \ No newline at end of file