Merge pull request #92 from import/feature/new-cache-driver
New cache driver documentation
This commit is contained in:
commit
ecd6e1d510
@ -100,6 +100,28 @@ driver by itself.
|
|||||||
$cacheDriver = new \Doctrine\Common\Cache\XcacheCache();
|
$cacheDriver = new \Doctrine\Common\Cache\XcacheCache();
|
||||||
$cacheDriver->save('cache_id', 'my_data');
|
$cacheDriver->save('cache_id', 'my_data');
|
||||||
|
|
||||||
|
Redis
|
||||||
|
~~~~~
|
||||||
|
|
||||||
|
In order to use the Redis cache driver you must have it compiled
|
||||||
|
and enabled in your php.ini. You can read about what is Redis
|
||||||
|
`from here <http://redis.io/>`_. Also check
|
||||||
|
`here <https://github.com/nicolasff/phpredis/>`_ for how you can use
|
||||||
|
and install Redis PHP extension.
|
||||||
|
|
||||||
|
Below is a simple example of how you could use the Redis cache
|
||||||
|
driver by itself.
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$redis = new Redis();
|
||||||
|
$redis->connect('redis_host', 6379);
|
||||||
|
|
||||||
|
$cacheDriver = new \Doctrine\Common\Cache\RedisCache();
|
||||||
|
$cacheDriver->setRedis($redis);
|
||||||
|
$cacheDriver->save('cache_id', 'my_data');
|
||||||
|
|
||||||
Using Cache Drivers
|
Using Cache Drivers
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ setup methods:
|
|||||||
These setup commands make several assumptions:
|
These setup commands make several assumptions:
|
||||||
|
|
||||||
- If `$devMode` is true always use an ``ArrayCache`` and set ``setAutoGenerateProxyClasses(true)``.
|
- If `$devMode` is true always use an ``ArrayCache`` and set ``setAutoGenerateProxyClasses(true)``.
|
||||||
- If `$devMode` is false, check for Caches in the order APC, Xcache, Memcache (127.0.0.1:11211) unless `$cache` is passed as fourth argument.
|
- If `$devMode` is false, check for Caches in the order APC, Xcache, Memcache (127.0.0.1:11211), Redis (127.0.0.1:6379) unless `$cache` is passed as fourth argument.
|
||||||
- If `$devMode` is false, set ``setAutoGenerateProxyClasses(false)``
|
- If `$devMode` is false, set ``setAutoGenerateProxyClasses(false)``
|
||||||
- If third argument `$proxyDir` is not set, use the systems temporary directory.
|
- If third argument `$proxyDir` is not set, use the systems temporary directory.
|
||||||
|
|
||||||
@ -280,6 +280,7 @@ The recommended implementations for production are:
|
|||||||
- ``Doctrine\Common\Cache\ApcCache``
|
- ``Doctrine\Common\Cache\ApcCache``
|
||||||
- ``Doctrine\Common\Cache\MemcacheCache``
|
- ``Doctrine\Common\Cache\MemcacheCache``
|
||||||
- ``Doctrine\Common\Cache\XcacheCache``
|
- ``Doctrine\Common\Cache\XcacheCache``
|
||||||
|
- ``Doctrine\Common\Cache\RedisCache``
|
||||||
|
|
||||||
For development you should use the
|
For development you should use the
|
||||||
``Doctrine\Common\Cache\ArrayCache`` which only caches data on a
|
``Doctrine\Common\Cache\ArrayCache`` which only caches data on a
|
||||||
@ -310,6 +311,7 @@ The recommended implementations for production are:
|
|||||||
- ``Doctrine\Common\Cache\ApcCache``
|
- ``Doctrine\Common\Cache\ApcCache``
|
||||||
- ``Doctrine\Common\Cache\MemcacheCache``
|
- ``Doctrine\Common\Cache\MemcacheCache``
|
||||||
- ``Doctrine\Common\Cache\XcacheCache``
|
- ``Doctrine\Common\Cache\XcacheCache``
|
||||||
|
- ``Doctrine\Common\Cache\RedisCache``
|
||||||
|
|
||||||
For development you should use the
|
For development you should use the
|
||||||
``Doctrine\Common\Cache\ArrayCache`` which only caches data on a
|
``Doctrine\Common\Cache\ArrayCache`` which only caches data on a
|
||||||
|
Loading…
Reference in New Issue
Block a user