Skip to content

Commit

Permalink
Move website config to default branch (doctrine#8287)
Browse files Browse the repository at this point in the history
Adds the website config to be compatible with the doctrine/doctrine-website#356 changes
  • Loading branch information
SenseException authored and l-vo committed Oct 11, 2020
1 parent e0eb82a commit 3c0a2a1
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions docs/en/reference/second-level-cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,21 @@ A query region might be something like :
Cache Regions
-------------

``Doctrine\ORM\Cache\Region\DefaultRegion`` It's the default implementation.
``Doctrine\ORM\Cache\Region\DefaultRegion`` is the default implementation.
A simplest cache region compatible with all doctrine-cache drivers but does not support locking.

``Doctrine\ORM\Cache\Region`` and ``Doctrine\ORM\Cache\ConcurrentRegion``
Defines contracts that should be implemented by a cache provider.
define contracts that should be implemented by a cache provider.

It allows you to provide your own cache implementation that might take advantage of specific cache driver.

If you want to support locking for ``READ_WRITE`` strategies you should implement ``ConcurrentRegion``; ``CacheRegion`` otherwise.
If you want to support locking for ``READ_WRITE`` strategies you should implement ``ConcurrentRegion`` (``CacheRegion`` otherwise).


Cache region
~~~~~~~~~~~~

Defines a contract for accessing a particular region.

``Doctrine\ORM\Cache\Region``

Defines a contract for accessing a particular cache region.
``Doctrine\ORM\Cache\Region`` defines a contract for accessing a particular
cache region.

`See API Doc <https://www.doctrine-project.org/api/orm/current/Doctrine/ORM/Cache/Region.html>`_.

Expand All @@ -107,9 +103,7 @@ By default, Doctrine provides a very simple implementation based on file locks `

If you want to use an ``READ_WRITE`` cache, you should consider providing your own cache region.

``Doctrine\ORM\Cache\ConcurrentRegion``

Defines contract for concurrently managed data region.
``Doctrine\ORM\Cache\ConcurrentRegion`` defines contract for concurrently managed data region.

`See API Doc <https://www.doctrine-project.org/api/orm/current/Doctrine/ORM/Cache/ConcurrentRegion.html>`_.

Expand Down Expand Up @@ -177,7 +171,7 @@ Doctrine allows you to specify configurations and some points of extension for t
Enable Second Level Cache
~~~~~~~~~~~~~~~~~~~~~~~~~

To enable the second-level-cache, you should provide a cache factory
To enable the second-level-cache, you should provide a cache factory.
``\Doctrine\ORM\Cache\DefaultCacheFactory`` is the default implementation.

.. code-block:: php
Expand All @@ -203,11 +197,11 @@ Cache Factory is the main point of extension.

It allows you to provide a specific implementation of the following components :

* ``QueryCache`` Store and retrieve query cache results.
* ``CachedEntityPersister`` Store and retrieve entity results.
* ``CachedCollectionPersister`` Store and retrieve query results.
* ``EntityHydrator`` Transform an entity into a cache entry and cache entry into entities
* ``CollectionHydrator`` Transform a collection into a cache entry and cache entry into collection
* ``QueryCache`` stores and retrieves query cache results.
* ``CachedEntityPersister`` stores and retrieves entity results.
* ``CachedCollectionPersister`` stores and retrieves query results.
* ``EntityHydrator`` transforms an entity into a cache entry and caches entries into entities
* ``CollectionHydrator`` transforms a collection into a cache entry and a cache entry into a collection

`See API Doc <http://www.doctrine-project.org/api/orm/current/Doctrine/ORM/Cache/DefaultCacheFactory.html>`_.

Expand All @@ -225,8 +219,8 @@ To specify a default lifetime for all regions or specify a different lifetime fo
$regionConfig = $cacheConfig->getRegionsConfiguration();
// Cache Region lifetime
$regionConfig->setLifetime('my_entity_region', 3600); // Time to live for a specific region; In seconds
$regionConfig->setDefaultLifetime(7200); // Default time to live; In seconds
$regionConfig->setLifetime('my_entity_region', 3600); // Time to live for a specific region (in seconds)
$regionConfig->setDefaultLifetime(7200); // Default time to live (in seconds)
Cache Log
Expand Down Expand Up @@ -267,8 +261,9 @@ By providing a cache logger you should be able to get information about all cach
// Get the total number of cached entries *not* found in all regions.
$logger->getMissCount();
If you want to get more information you should implement ``\Doctrine\ORM\Cache\Logging\CacheLogger``.
and collect all information you want.
If you want to get more information you should implement
``\Doctrine\ORM\Cache\Logging\CacheLogger`` and collect
all information you want.

`See API Doc <http://www.doctrine-project.org/api/orm/current/Doctrine/ORM/Cache/Logging/CacheLogger.html>`_.

Expand All @@ -277,8 +272,11 @@ Entity cache definition
-----------------------
* Entity cache configuration allows you to define the caching strategy and region for an entity.

* ``usage`` Specifies the caching strategy: ``READ_ONLY``, ``NONSTRICT_READ_WRITE``, ``READ_WRITE``. see :ref:`reference-second-level-cache-mode`
* ``region`` Optional value that specifies the name of the second level cache region.
* ``usage`` specifies the caching strategy: ``READ_ONLY``,
`NONSTRICT_READ_WRITE``, ``READ_WRITE``.
See :ref:`reference-second-level-cache-mode`.
* ``region`` is an optional value that specifies the name of the second
level cache region.


.. configuration-block::
Expand Down Expand Up @@ -579,7 +577,8 @@ The Cache Mode controls how a particular query interacts with the second-level c
DELETE / UPDATE queries
~~~~~~~~~~~~~~~~~~~~~~~

DQL UPDATE / DELETE statements are ported directly into a database and bypass the second-level cache,
DQL UPDATE / DELETE statements are ported directly into a database and bypass
the second-level cache.
Entities that are already cached will NOT be invalidated.
However the cached data could be evicted using the cache API or an special query hint.

Expand Down Expand Up @@ -622,7 +621,7 @@ Using the repository query cache
--------------------------------

As well as ``Query Cache`` all persister queries store only identifier values for an individual query.
All persister use a single timestamps cache region keeps track of the last update for each persister,
All persister use a single timestamp cache region to keep track of the last update for each persister,
When a query is loaded from cache, the timestamp region is checked for the last update for that persister.
Using the last update timestamps as part of the query key invalidate the cache key when an update occurs.

Expand All @@ -641,7 +640,7 @@ Using the last update timestamps as part of the query key invalidate the cache k
$em->clear();
// Reload from database.
// At this point the query cache key if not logger valid, the select goes straight
// At this point the query cache key is no longer valid, the select goes straight to the database
$entities = $em->getRepository('Entity\Country')->findAll();
Cache API
Expand Down Expand Up @@ -728,4 +727,5 @@ Paginator
~~~~~~~~~

Count queries generated by ``Doctrine\ORM\Tools\Pagination\Paginator`` are not cached by second-level cache.
Although entities and query result are cached count queries will hit the database every time.
Although entities and query result are cached,count queries will hit the
database every time.

0 comments on commit 3c0a2a1

Please sign in to comment.