-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,190 changed files
with
23,536 additions
and
24,931 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,52 +20,52 @@ | |
|
||
namespace Doctrine\ORM; | ||
|
||
use Doctrine\ORM\Cache\QueryCache; | ||
use Doctrine\ORM\Cache\Region; | ||
|
||
/** | ||
* Provides an API for querying/managing the second level cache regions. | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
interface Cache | ||
{ | ||
const DEFAULT_QUERY_REGION_NAME = 'query_cache_region'; | ||
public const DEFAULT_QUERY_REGION_NAME = 'query_cache_region'; | ||
|
||
const DEFAULT_TIMESTAMP_REGION_NAME = 'timestamp_cache_region'; | ||
public const DEFAULT_TIMESTAMP_REGION_NAME = 'timestamp_cache_region'; | ||
|
||
/** | ||
* May read items from the cache, but will not add items. | ||
*/ | ||
const MODE_GET = 1; | ||
public const MODE_GET = 1; | ||
|
||
/** | ||
* Will never read items from the cache, | ||
* but will add items to the cache as it reads them from the database. | ||
*/ | ||
const MODE_PUT = 2; | ||
public const MODE_PUT = 2; | ||
|
||
/** | ||
* May read items from the cache, and add items to the cache. | ||
*/ | ||
const MODE_NORMAL = 3; | ||
public const MODE_NORMAL = 3; | ||
|
||
/** | ||
* The query will never read items from the cache, | ||
* but will refresh items to the cache as it reads them from the database. | ||
*/ | ||
const MODE_REFRESH = 4; | ||
public const MODE_REFRESH = 4; | ||
|
||
/** | ||
* @param string $className The entity class. | ||
* | ||
* @return \Doctrine\ORM\Cache\Region|null | ||
* @return Region|null | ||
*/ | ||
public function getEntityCacheRegion($className); | ||
|
||
/** | ||
* @param string $className The entity class. | ||
* @param string $association The field name that represents the association. | ||
* | ||
* @return \Doctrine\ORM\Cache\Region|null | ||
* @return Region|null | ||
*/ | ||
public function getCollectionCacheRegion($className, $association); | ||
|
||
|
@@ -75,7 +75,7 @@ public function getCollectionCacheRegion($className, $association); | |
* @param string $className The entity class. | ||
* @param mixed $identifier The entity identifier | ||
* | ||
* @return boolean true if the underlying cache contains corresponding data; false otherwise. | ||
* @return bool true if the underlying cache contains corresponding data; false otherwise. | ||
*/ | ||
public function containsEntity($className, $identifier); | ||
|
||
|
@@ -112,7 +112,7 @@ public function evictEntityRegions(); | |
* @param string $association The field name that represents the association. | ||
* @param mixed $ownerIdentifier The identifier of the owning entity. | ||
* | ||
* @return boolean true if the underlying cache contains corresponding data; false otherwise. | ||
* @return bool true if the underlying cache contains corresponding data; false otherwise. | ||
*/ | ||
public function containsCollection($className, $association, $ownerIdentifier); | ||
|
||
|
@@ -149,7 +149,7 @@ public function evictCollectionRegions(); | |
* | ||
* @param string $regionName The cache name given to the query. | ||
* | ||
* @return boolean true if the underlying cache contains corresponding data; false otherwise. | ||
* @return bool true if the underlying cache contains corresponding data; false otherwise. | ||
*/ | ||
public function containsQuery($regionName); | ||
|
||
|
@@ -172,7 +172,7 @@ public function evictQueryRegions(); | |
* | ||
* @param string|null $regionName Query cache region name, or default query cache if the region name is NULL. | ||
* | ||
* @return \Doctrine\ORM\Cache\QueryCache The Query Cache associated with the region name. | ||
* @return QueryCache The Query Cache associated with the region name. | ||
*/ | ||
public function getQueryCache($regionName = null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,6 @@ | |
|
||
/** | ||
* Association cache entry | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
class AssociationCacheEntry implements CacheEntry | ||
{ | ||
|
@@ -48,8 +45,8 @@ class AssociationCacheEntry implements CacheEntry | |
*/ | ||
public function __construct($class, array $identifier) | ||
{ | ||
$this->class = $class; | ||
$this->identifier = $identifier; | ||
$this->class = $class; | ||
$this->identifier = $identifier; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,43 +24,30 @@ | |
|
||
/** | ||
* Configuration container for second-level cache. | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
class CacheConfiguration | ||
{ | ||
/** | ||
* @var \Doctrine\ORM\Cache\CacheFactory|null | ||
*/ | ||
/** @var CacheFactory|null */ | ||
private $cacheFactory; | ||
|
||
/** | ||
* @var \Doctrine\ORM\Cache\RegionsConfiguration|null | ||
*/ | ||
/** @var RegionsConfiguration|null */ | ||
private $regionsConfig; | ||
|
||
/** | ||
* @var \Doctrine\ORM\Cache\Logging\CacheLogger|null | ||
*/ | ||
/** @var CacheLogger|null */ | ||
private $cacheLogger; | ||
|
||
/** | ||
* @var \Doctrine\ORM\Cache\QueryCacheValidator|null | ||
*/ | ||
/** @var QueryCacheValidator|null */ | ||
private $queryValidator; | ||
|
||
/** | ||
* @return \Doctrine\ORM\Cache\CacheFactory|null | ||
* @return CacheFactory|null | ||
*/ | ||
public function getCacheFactory() | ||
{ | ||
return $this->cacheFactory; | ||
} | ||
|
||
/** | ||
* @param \Doctrine\ORM\Cache\CacheFactory $factory | ||
* | ||
* @return void | ||
*/ | ||
public function setCacheFactory(CacheFactory $factory) | ||
|
@@ -69,23 +56,20 @@ public function setCacheFactory(CacheFactory $factory) | |
} | ||
|
||
/** | ||
* @return \Doctrine\ORM\Cache\Logging\CacheLogger|null | ||
* @return CacheLogger|null | ||
*/ | ||
public function getCacheLogger() | ||
{ | ||
return $this->cacheLogger; | ||
} | ||
|
||
/** | ||
* @param \Doctrine\ORM\Cache\Logging\CacheLogger $logger | ||
*/ | ||
public function setCacheLogger(CacheLogger $logger) | ||
{ | ||
$this->cacheLogger = $logger; | ||
} | ||
|
||
/** | ||
* @return \Doctrine\ORM\Cache\RegionsConfiguration | ||
* @return RegionsConfiguration | ||
*/ | ||
public function getRegionsConfiguration() | ||
{ | ||
|
@@ -96,16 +80,13 @@ public function getRegionsConfiguration() | |
return $this->regionsConfig; | ||
} | ||
|
||
/** | ||
* @param \Doctrine\ORM\Cache\RegionsConfiguration $regionsConfig | ||
*/ | ||
public function setRegionsConfiguration(RegionsConfiguration $regionsConfig) | ||
{ | ||
$this->regionsConfig = $regionsConfig; | ||
} | ||
|
||
/** | ||
* @return \Doctrine\ORM\Cache\QueryCacheValidator | ||
* @return QueryCacheValidator | ||
*/ | ||
public function getQueryValidator() | ||
{ | ||
|
@@ -118,9 +99,6 @@ public function getQueryValidator() | |
return $this->queryValidator; | ||
} | ||
|
||
/** | ||
* @param \Doctrine\ORM\Cache\QueryCacheValidator $validator | ||
*/ | ||
public function setQueryValidator(QueryCacheValidator $validator) | ||
{ | ||
$this->queryValidator = $validator; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,7 @@ | |
* <b>IMPORTANT NOTE:</b> | ||
* | ||
* Fields of classes that implement CacheEntry are public for performance reason. | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
interface CacheEntry | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
|
@@ -21,19 +22,18 @@ | |
|
||
use Doctrine\ORM\ORMException; | ||
|
||
use function sprintf; | ||
|
||
/** | ||
* Exception for cache. | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
class CacheException extends ORMException | ||
{ | ||
/** | ||
* @param string $sourceEntity | ||
* @param string $fieldName | ||
* | ||
* @return \Doctrine\ORM\Cache\CacheException | ||
* @return CacheException | ||
*/ | ||
public static function updateReadOnlyCollection($sourceEntity, $fieldName) | ||
{ | ||
|
@@ -43,7 +43,7 @@ public static function updateReadOnlyCollection($sourceEntity, $fieldName) | |
/** | ||
* @param string $entityName | ||
* | ||
* @return \Doctrine\ORM\Cache\CacheException | ||
* @return CacheException | ||
*/ | ||
public static function updateReadOnlyEntity($entityName) | ||
{ | ||
|
@@ -53,7 +53,7 @@ public static function updateReadOnlyEntity($entityName) | |
/** | ||
* @param string $entityName | ||
* | ||
* @return \Doctrine\ORM\Cache\CacheException | ||
* @return CacheException | ||
*/ | ||
public static function nonCacheableEntity($entityName) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,68 +20,68 @@ | |
|
||
namespace Doctrine\ORM\Cache; | ||
|
||
use Doctrine\ORM\Mapping\ClassMetadata; | ||
use Doctrine\ORM\Cache; | ||
use Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister; | ||
use Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Doctrine\ORM\Mapping\ClassMetadata; | ||
use Doctrine\ORM\Persisters\Collection\CollectionPersister; | ||
use Doctrine\ORM\Persisters\Entity\EntityPersister; | ||
|
||
/** | ||
* Contract for building second level cache regions components. | ||
* | ||
* @since 2.5 | ||
* @author Fabio B. Silva <[email protected]> | ||
*/ | ||
interface CacheFactory | ||
{ | ||
/** | ||
* Build an entity persister for the given entity metadata. | ||
* | ||
* @param \Doctrine\ORM\EntityManagerInterface $em The entity manager. | ||
* @param \Doctrine\ORM\Persisters\Entity\EntityPersister $persister The entity persister that will be cached. | ||
* @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata. | ||
* @param EntityManagerInterface $em The entity manager. | ||
* @param EntityPersister $persister The entity persister that will be cached. | ||
* @param ClassMetadata $metadata The entity metadata. | ||
* | ||
* @return \Doctrine\ORM\Cache\Persister\Entity\CachedEntityPersister | ||
* @return CachedEntityPersister | ||
*/ | ||
public function buildCachedEntityPersister(EntityManagerInterface $em, EntityPersister $persister, ClassMetadata $metadata); | ||
|
||
/** | ||
* Build a collection persister for the given relation mapping. | ||
* | ||
* @param \Doctrine\ORM\EntityManagerInterface $em The entity manager. | ||
* @param \Doctrine\ORM\Persisters\Collection\CollectionPersister $persister The collection persister that will be cached. | ||
* @param array $mapping The association mapping. | ||
* @param EntityManagerInterface $em The entity manager. | ||
* @param CollectionPersister $persister The collection persister that will be cached. | ||
* @param array $mapping The association mapping. | ||
* | ||
* @return \Doctrine\ORM\Cache\Persister\Collection\CachedCollectionPersister | ||
* @return CachedCollectionPersister | ||
*/ | ||
public function buildCachedCollectionPersister(EntityManagerInterface $em, CollectionPersister $persister, array $mapping); | ||
|
||
/** | ||
* Build a query cache based on the given region name | ||
* | ||
* @param \Doctrine\ORM\EntityManagerInterface $em The Entity manager. | ||
* @param string $regionName The region name. | ||
* @param EntityManagerInterface $em The Entity manager. | ||
* @param string $regionName The region name. | ||
* | ||
* @return \Doctrine\ORM\Cache\QueryCache The built query cache. | ||
* @return QueryCache The built query cache. | ||
*/ | ||
public function buildQueryCache(EntityManagerInterface $em, $regionName = null); | ||
|
||
/** | ||
* Build an entity hydrator | ||
* | ||
* @param \Doctrine\ORM\EntityManagerInterface $em The Entity manager. | ||
* @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata. | ||
* @param EntityManagerInterface $em The Entity manager. | ||
* @param ClassMetadata $metadata The entity metadata. | ||
* | ||
* @return \Doctrine\ORM\Cache\EntityHydrator The built entity hydrator. | ||
* @return EntityHydrator The built entity hydrator. | ||
*/ | ||
public function buildEntityHydrator(EntityManagerInterface $em, ClassMetadata $metadata); | ||
|
||
/** | ||
* Build a collection hydrator | ||
* | ||
* @param \Doctrine\ORM\EntityManagerInterface $em The Entity manager. | ||
* @param array $mapping The association mapping. | ||
* @param EntityManagerInterface $em The Entity manager. | ||
* @param array $mapping The association mapping. | ||
* | ||
* @return \Doctrine\ORM\Cache\CollectionHydrator The built collection hydrator. | ||
* @return CollectionHydrator The built collection hydrator. | ||
*/ | ||
public function buildCollectionHydrator(EntityManagerInterface $em, array $mapping); | ||
|
||
|
@@ -90,23 +90,21 @@ public function buildCollectionHydrator(EntityManagerInterface $em, array $mappi | |
* | ||
* @param array $cache The cache configuration. | ||
* | ||
* @return \Doctrine\ORM\Cache\Region The cache region. | ||
* @return Region The cache region. | ||
*/ | ||
public function getRegion(array $cache); | ||
|
||
/** | ||
* Build timestamp cache region | ||
* | ||
* @return \Doctrine\ORM\Cache\TimestampRegion The timestamp region. | ||
* @return TimestampRegion The timestamp region. | ||
*/ | ||
public function getTimestampRegion(); | ||
|
||
/** | ||
* Build \Doctrine\ORM\Cache | ||
* | ||
* @param EntityManagerInterface $entityManager | ||
* | ||
* @return \Doctrine\ORM\Cache | ||
* @return Cache | ||
*/ | ||
public function createCache(EntityManagerInterface $entityManager); | ||
} |
Oops, something went wrong.