Permalink
Browse files

Merge pull request #808 from FabioBatSilva/slc

Second level cache
  • Loading branch information...
2 parents 86ae6f1 + 4e0e1b8 commit b081e5681d9dc75ea2ab4a609e1aff5f4b7f2b87 @guilhermeblanco guilhermeblanco committed Dec 16, 2013
Showing with 16,654 additions and 393 deletions.
  1. +7 −4 .travis.yml
  2. +1 −0 docs/en/index.rst
  3. +12 −0 docs/en/reference/annotations-reference.rst
  4. +725 −0 docs/en/reference/second-level-cache.rst
  5. +8 −4 docs/en/toc.rst
  6. +18 −0 doctrine-mapping.xsd
  7. +241 −16 lib/Doctrine/ORM/AbstractQuery.php
  8. +187 −0 lib/Doctrine/ORM/Cache.php
  9. +159 −0 lib/Doctrine/ORM/Cache/CacheConfiguration.php
  10. +36 −0 lib/Doctrine/ORM/Cache/CacheEntry.php
  11. +72 −0 lib/Doctrine/ORM/Cache/CacheException.php
  12. +104 −0 lib/Doctrine/ORM/Cache/CacheFactory.php
  13. +38 −0 lib/Doctrine/ORM/Cache/CacheKey.php
  14. +57 −0 lib/Doctrine/ORM/Cache/CollectionCacheEntry.php
  15. +66 −0 lib/Doctrine/ORM/Cache/CollectionCacheKey.php
  16. +54 −0 lib/Doctrine/ORM/Cache/CollectionHydrator.php
  17. +59 −0 lib/Doctrine/ORM/Cache/ConcurrentRegion.php
  18. +342 −0 lib/Doctrine/ORM/Cache/DefaultCache.php
  19. +235 −0 lib/Doctrine/ORM/Cache/DefaultCacheFactory.php
  20. +103 −0 lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php
  21. +150 −0 lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php
  22. +338 −0 lib/Doctrine/ORM/Cache/DefaultQueryCache.php
  23. +66 −0 lib/Doctrine/ORM/Cache/EntityCacheEntry.php
  24. +57 −0 lib/Doctrine/ORM/Cache/EntityCacheKey.php
  25. +51 −0 lib/Doctrine/ORM/Cache/EntityHydrator.php
  26. +58 −0 lib/Doctrine/ORM/Cache/Lock.php
  27. +32 −0 lib/Doctrine/ORM/Cache/LockException.php
  28. +106 −0 lib/Doctrine/ORM/Cache/Logging/CacheLogger.php
  29. +156 −0 lib/Doctrine/ORM/Cache/Logging/CacheLoggerChain.php
  30. +251 −0 lib/Doctrine/ORM/Cache/Logging/StatisticsCacheLogger.php
  31. +275 −0 lib/Doctrine/ORM/Cache/Persister/AbstractCollectionPersister.php
  32. +534 −0 lib/Doctrine/ORM/Cache/Persister/AbstractEntityPersister.php
  33. +64 −0 lib/Doctrine/ORM/Cache/Persister/CachedCollectionPersister.php
  34. +45 −0 lib/Doctrine/ORM/Cache/Persister/CachedEntityPersister.php
  35. +46 −0 lib/Doctrine/ORM/Cache/Persister/CachedPersister.php
  36. +104 −0 lib/Doctrine/ORM/Cache/Persister/NonStrictReadWriteCachedCollectionPersister.php
  37. +124 −0 lib/Doctrine/ORM/Cache/Persister/NonStrictReadWriteCachedEntityPersister.php
  38. +44 −0 lib/Doctrine/ORM/Cache/Persister/ReadOnlyCachedCollectionPersister.php
  39. +41 −0 lib/Doctrine/ORM/Cache/Persister/ReadOnlyCachedEntityPersister.php
  40. +135 −0 lib/Doctrine/ORM/Cache/Persister/ReadWriteCachedCollectionPersister.php
  41. +138 −0 lib/Doctrine/ORM/Cache/Persister/ReadWriteCachedEntityPersister.php
  42. +62 −0 lib/Doctrine/ORM/Cache/QueryCache.php
  43. +62 −0 lib/Doctrine/ORM/Cache/QueryCacheEntry.php
  44. +58 −0 lib/Doctrine/ORM/Cache/QueryCacheKey.php
  45. +42 −0 lib/Doctrine/ORM/Cache/QueryCacheValidator.php
  46. +86 −0 lib/Doctrine/ORM/Cache/Region.php
  47. +121 −0 lib/Doctrine/ORM/Cache/Region/DefaultRegion.php
  48. +245 −0 lib/Doctrine/ORM/Cache/Region/FileLockRegion.php
  49. +42 −0 lib/Doctrine/ORM/Cache/Region/UpdateTimestampCache.php
  50. +134 −0 lib/Doctrine/ORM/Cache/RegionsConfiguration.php
  51. +57 −0 lib/Doctrine/ORM/Cache/TimestampCacheEntry.php
  52. +38 −0 lib/Doctrine/ORM/Cache/TimestampCacheKey.php
  53. +43 −0 lib/Doctrine/ORM/Cache/TimestampQueryCacheValidator.php
  54. +39 −0 lib/Doctrine/ORM/Cache/TimestampRegion.php
  55. +57 −4 lib/Doctrine/ORM/Configuration.php
  56. +8 −0 lib/Doctrine/ORM/Decorator/EntityManagerDecorator.php
  57. +19 −1 lib/Doctrine/ORM/EntityManager.php
  58. +7 −0 lib/Doctrine/ORM/EntityManagerInterface.php
  59. +44 −0 lib/Doctrine/ORM/Mapping/Cache.php
  60. +4 −0 lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
  61. +63 −1 lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
  62. +19 −0 lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
  63. +2 −1 lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php
  64. +51 −0 lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
  65. +53 −0 lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
  66. +24 −0 lib/Doctrine/ORM/ORMException.php
  67. +13 −81 lib/Doctrine/ORM/Persisters/AbstractCollectionPersister.php
  68. +50 −170 lib/Doctrine/ORM/Persisters/BasicEntityPersister.php
  69. +139 −0 lib/Doctrine/ORM/Persisters/CollectionPersister.php
  70. +299 −0 lib/Doctrine/ORM/Persisters/EntityPersister.php
  71. +1 −1 lib/Doctrine/ORM/Persisters/JoinedSubclassPersister.php
  72. +3 −13 lib/Doctrine/ORM/Persisters/ManyToManyPersister.php
  73. +4 −16 lib/Doctrine/ORM/Persisters/OneToManyPersister.php
  74. +17 −16 lib/Doctrine/ORM/Proxy/ProxyFactory.php
  75. +58 −15 lib/Doctrine/ORM/Query.php
  76. +8 −0 lib/Doctrine/ORM/Query/ResultSetMapping.php
  77. +4 −1 lib/Doctrine/ORM/Query/SqlWalker.php
  78. +134 −0 lib/Doctrine/ORM/Tools/Console/Command/ClearCache/CollectionRegionCommand.php
  79. +132 −0 lib/Doctrine/ORM/Tools/Console/Command/ClearCache/EntityRegionCommand.php
  80. +124 −0 lib/Doctrine/ORM/Tools/Console/Command/ClearCache/QueryRegionCommand.php
  81. +135 −40 lib/Doctrine/ORM/UnitOfWork.php
  82. +35 −0 tests/Doctrine/Tests/EventListener/CacheMetadataListener.php
  83. +13 −0 tests/Doctrine/Tests/Mocks/CacheEntryMock.php
  84. +21 −0 tests/Doctrine/Tests/Mocks/CacheKeyMock.php
  85. +115 −0 tests/Doctrine/Tests/Mocks/CacheRegionMock.php
  86. +202 −0 tests/Doctrine/Tests/Mocks/ConcurrentRegionMock.php
  87. +19 −0 tests/Doctrine/Tests/Mocks/TimestampRegionMock.php
  88. +95 −0 tests/Doctrine/Tests/Models/Cache/Attraction.php
  89. +33 −0 tests/Doctrine/Tests/Models/Cache/AttractionContactInfo.php
  90. +54 −0 tests/Doctrine/Tests/Models/Cache/AttractionInfo.php
  91. +33 −0 tests/Doctrine/Tests/Models/Cache/AttractionLocationInfo.php
  92. +11 −0 tests/Doctrine/Tests/Models/Cache/Bar.php
  93. +11 −0 tests/Doctrine/Tests/Models/Cache/Beach.php
  94. +109 −0 tests/Doctrine/Tests/Models/Cache/City.php
  95. +50 −0 tests/Doctrine/Tests/Models/Cache/Country.php
  96. +65 −0 tests/Doctrine/Tests/Models/Cache/Flight.php
  97. +11 −0 tests/Doctrine/Tests/Models/Cache/Restaurant.php
  98. +92 −0 tests/Doctrine/Tests/Models/Cache/State.php
  99. +112 −0 tests/Doctrine/Tests/Models/Cache/Travel.php
  100. +91 −0 tests/Doctrine/Tests/Models/Cache/Traveler.php
  101. +85 −0 tests/Doctrine/Tests/ORM/Cache/AbstractRegionTest.php
  102. +82 −0 tests/Doctrine/Tests/ORM/Cache/CacheConfigTest.php
  103. +68 −0 tests/Doctrine/Tests/ORM/Cache/CacheKeyTest.php
  104. +118 −0 tests/Doctrine/Tests/ORM/Cache/CacheLoggerChainTest.php
  105. +267 −0 tests/Doctrine/Tests/ORM/Cache/DefaultCacheFactoryTest.php
  106. +263 −0 tests/Doctrine/Tests/ORM/Cache/DefaultCacheTest.php
  107. +77 −0 tests/Doctrine/Tests/ORM/Cache/DefaultCollectionHydratorTest.php
  108. +125 −0 tests/Doctrine/Tests/ORM/Cache/DefaultEntityHydratorTest.php
  109. +549 −0 tests/Doctrine/Tests/ORM/Cache/DefaultQueryCacheTest.php
  110. +50 −0 tests/Doctrine/Tests/ORM/Cache/DefaultRegionTest.php
  111. +250 −0 tests/Doctrine/Tests/ORM/Cache/FileLockRegionTest.php
  112. +301 −0 tests/Doctrine/Tests/ORM/Cache/Persister/AbstractCollectionPersisterTest.php
  113. +416 −0 tests/Doctrine/Tests/ORM/Cache/Persister/AbstractEntityPersisterTest.php
  114. +23 −0 tests/Doctrine/Tests/ORM/Cache/Persister/NonStrictReadWriteCachedCollectionPersisterTest.php
  115. +140 −0 tests/Doctrine/Tests/ORM/Cache/Persister/NonStrictReadWriteCachedEntityPersisterTest.php
  116. +22 −0 tests/Doctrine/Tests/ORM/Cache/Persister/ReadOnlyCachedCollectionPersisterTest.php
  117. +36 −0 tests/Doctrine/Tests/ORM/Cache/Persister/ReadOnlyCachedEntityPersisterTest.php
  118. +301 −0 tests/Doctrine/Tests/ORM/Cache/Persister/ReadWriteCachedCollectionPersisterTest.php
  119. +234 −0 tests/Doctrine/Tests/ORM/Cache/Persister/ReadWriteCachedEntityPersisterTest.php
  120. +134 −0 tests/Doctrine/Tests/ORM/Cache/StatisticsCacheLoggerTest.php
  121. +12 −0 tests/Doctrine/Tests/ORM/ConfigurationTest.php
  122. +3 −0 tests/Doctrine/Tests/ORM/Functional/DefaultValuesTest.php
  123. +6 −0 tests/Doctrine/Tests/ORM/Functional/ExtraLazyCollectionTest.php
  124. +1 −1 tests/Doctrine/Tests/ORM/Functional/JoinedTableCompositeKeyTest.php
  125. +9 −0 tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php
  126. +2 −0 tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php
  127. +203 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheAbstractTest.php
  128. +175 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheCompositePrimaryKeyTest.php
  129. +146 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheConcurrentTest.php
  130. +81 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheExtraLazyCollectionTest.php
  131. +191 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheJoinTableInheritanceTest.php
  132. +214 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheManyToManyTest.php
  133. +121 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheManyToOneTest.php
  134. +350 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheOneToManyTest.php
  135. +898 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheQueryCacheTest.php
  136. +250 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheRepositoryTest.php
  137. +209 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheSingleTableInheritanceTest.php
  138. +351 −0 tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheTest.php
  139. +1 −1 tests/Doctrine/Tests/ORM/Functional/SingleTableCompositeKeyTest.php
  140. +8 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC117Test.php
  141. +3 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1301Test.php
  142. +1 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1595Test.php
  143. +1 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php
  144. +1 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2090Test.php
  145. +1 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2350Test.php
  146. +1 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2494Test.php
  147. +3 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC742Test.php
  148. +29 −1 tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php
  149. +54 −0 tests/Doctrine/Tests/ORM/Mapping/php/Doctrine.Tests.Models.Cache.City.php
  150. +23 −0 tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Cache.City.dcm.xml
  151. +36 −0 tests/Doctrine/Tests/ORM/Mapping/yaml/Doctrine.Tests.Models.Cache.City.dcm.yml
  152. +282 −0 tests/Doctrine/Tests/ORM/Performance/SecondLevelCacheTest.php
  153. +94 −0 tests/Doctrine/Tests/ORM/Tools/Console/Command/ClearCacheCollectionRegionCommandTest.php
  154. +91 −0 tests/Doctrine/Tests/ORM/Tools/Console/Command/ClearCacheEntityRegionCommandTest.php
  155. +90 −0 tests/Doctrine/Tests/ORM/Tools/Console/Command/ClearCacheQueryRegionCommandTest.php
  156. +62 −1 tests/Doctrine/Tests/OrmFunctionalTestCase.php
  157. +60 −0 tests/Doctrine/Tests/OrmTestCase.php
  158. +7 −1 tests/travis/mysql.travis.xml
  159. +7 −2 tests/travis/pgsql.travis.xml
  160. +7 −2 tests/travis/sqlite.travis.xml
  161. +14 −0 tools/sandbox/bootstrap.php
  162. +3 −0 tools/sandbox/doctrine.php
View
@@ -7,9 +7,12 @@ php:
- hhvm
env:
- - DB=mysql
- - DB=pgsql
- - DB=sqlite
+ - DB=mysql ENABLE_SECOND_LEVEL_CACHE=1
+ - DB=pgsql ENABLE_SECOND_LEVEL_CACHE=1
+ - DB=sqlite ENABLE_SECOND_LEVEL_CACHE=1
+ - DB=mysql ENABLE_SECOND_LEVEL_CACHE=0
+ - DB=pgsql ENABLE_SECOND_LEVEL_CACHE=0
+ - DB=sqlite ENABLE_SECOND_LEVEL_CACHE=0
before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS doctrine_tests;' -U postgres; fi"
@@ -19,7 +22,7 @@ before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS doctrine_tests_tmp;create database IF NOT EXISTS doctrine_tests;'; fi"
- composer install --prefer-dist --dev
-script: phpunit --configuration tests/travis/$DB.travis.xml
+script: phpunit -v --configuration tests/travis/$DB.travis.xml
after_script:
- php vendor/bin/coveralls -v
View
@@ -79,6 +79,7 @@ Advanced Topics
* :doc:`Best Practices <reference/best-practices>`
* :doc:`Metadata Drivers <reference/metadata-drivers>`
* :doc:`Batch Processing <reference/batch-processing>`
+* :doc:`Second Level Cache <reference/second-level-cache>`
Tutorials
---------
@@ -35,6 +35,7 @@ Index
- :ref:`@Column <annref_column>`
- :ref:`@ColumnResult <annref_column_result>`
+- :ref:`@Cache <annref_cache>`
- :ref:`@ChangeTrackingPolicy <annref_changetrackingpolicy>`
- :ref:`@DiscriminatorColumn <annref_discriminatorcolumn>`
- :ref:`@DiscriminatorMap <annref_discriminatormap>`
@@ -152,6 +153,17 @@ Required attributes:
- **name**: The name of a column in the SELECT clause of a SQL query
+.. _annref_cache:
+
+@Cache
+~~~~~~~~~~~~~~
+Add caching strategy to a root entity or a collection.
+
+Optional attributes:
+
+- **usage**: One of ``READ_ONLY``, ``READ_READ_WRITE`` or ``NONSTRICT_READ_WRITE``, By default this is ``READ_ONLY``.
+- **region**: An specific region name
+
.. _annref_changetrackingpolicy:
@ChangeTrackingPolicy
Oops, something went wrong.

0 comments on commit b081e56

Please sign in to comment.