1
0
mirror of synced 2025-03-06 12:56:10 +03:00

Merge pull request #6588 from reypm/master

Updating docs to support for APCu as a cache driver
This commit is contained in:
Marco Pivetta 2017-07-31 17:00:36 +02:00 committed by GitHub
commit 97914c0f3e
3 changed files with 25 additions and 5 deletions

View File

@ -152,6 +152,7 @@ The recommended implementations for production are:
- ``Doctrine\Common\Cache\ApcCache`` - ``Doctrine\Common\Cache\ApcCache``
- ``Doctrine\Common\Cache\ApcuCache``
- ``Doctrine\Common\Cache\MemcacheCache`` - ``Doctrine\Common\Cache\MemcacheCache``
- ``Doctrine\Common\Cache\XcacheCache`` - ``Doctrine\Common\Cache\XcacheCache``
- ``Doctrine\Common\Cache\RedisCache`` - ``Doctrine\Common\Cache\RedisCache``
@ -183,6 +184,7 @@ The recommended implementations for production are:
- ``Doctrine\Common\Cache\ApcCache`` - ``Doctrine\Common\Cache\ApcCache``
- ``Doctrine\Common\Cache\ApcuCache``
- ``Doctrine\Common\Cache\MemcacheCache`` - ``Doctrine\Common\Cache\MemcacheCache``
- ``Doctrine\Common\Cache\XcacheCache`` - ``Doctrine\Common\Cache\XcacheCache``
- ``Doctrine\Common\Cache\RedisCache`` - ``Doctrine\Common\Cache\RedisCache``

View File

@ -63,6 +63,24 @@ by itself.
$cacheDriver = new \Doctrine\Common\Cache\ApcCache(); $cacheDriver = new \Doctrine\Common\Cache\ApcCache();
$cacheDriver->save('cache_id', 'my_data'); $cacheDriver->save('cache_id', 'my_data');
APCu
~~~~
In order to use the APCu cache driver you must have it compiled and
enabled in your php.ini. You can read about APCu
`in the PHP Documentation <http://us2.php.net/apcu>`_. It will give
you a little background information about what it is and how you
can use it as well as how to install it.
Below is a simple example of how you could use the APCu cache driver
by itself.
.. code-block:: php
<?php
$cacheDriver = new \Doctrine\Common\Cache\ApcuCache();
$cacheDriver->save('cache_id', 'my_data');
Memcache Memcache
~~~~~~~~ ~~~~~~~~
@ -287,7 +305,7 @@ use on your ORM configuration.
<?php <?php
$config = new \Doctrine\ORM\Configuration(); $config = new \Doctrine\ORM\Configuration();
$config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcCache()); $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
Result Cache Result Cache
~~~~~~~~~~~~ ~~~~~~~~~~~~
@ -300,7 +318,7 @@ cache implementation.
.. code-block:: php .. code-block:: php
<?php <?php
$config->setResultCacheImpl(new \Doctrine\Common\Cache\ApcCache()); $config->setResultCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
Now when you're executing DQL queries you can configure them to use Now when you're executing DQL queries you can configure them to use
the result cache. the result cache.
@ -317,7 +335,7 @@ result cache driver.
.. code-block:: php .. code-block:: php
<?php <?php
$query->setResultCacheDriver(new \Doctrine\Common\Cache\ApcCache()); $query->setResultCacheDriver(new \Doctrine\Common\Cache\ApcuCache());
.. note:: .. note::
@ -369,7 +387,7 @@ first.
.. code-block:: php .. code-block:: php
<?php <?php
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcCache()); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcuCache());
Now the metadata information will only be parsed once and stored in Now the metadata information will only be parsed once and stored in
the cache driver. the cache driver.

View File

@ -35,7 +35,7 @@ an entity.
.. code-block:: php .. code-block:: php
<?php <?php
$em->getConfiguration()->setMetadataCacheImpl(new ApcCache()); $em->getConfiguration()->setMetadataCacheImpl(new ApcuCache());
If you want to use one of the included core metadata drivers you If you want to use one of the included core metadata drivers you