1
0
mirror of synced 2025-01-31 12:32:59 +03:00

[DDC-1766] Add usage of default result cache driver, add more docs.

This commit is contained in:
Benjamin Eberlei 2012-04-04 23:47:32 +02:00
parent fd2a22bd56
commit c32a77e6be

View File

@ -308,11 +308,24 @@ abstract class AbstractQuery
/**
* Set a cache profile for hydration caching.
*
* If no result cache driver is set in the QueryCacheProfile, the default
* result cache driver is used from the configuration.
*
* @example
* $lifetime = 100;
* $resultKey = "abc";
* $query->setHydrationCacheProfile(new QueryCacheProfile());
* $query->setHydrationCacheProfile(new QueryCacheProfile($lifetime, $resultKey));
*
* @param \Doctrine\DBAL\Cache\QueryCacheProfile $profile
* @return \Doctrine\ORM\AbstractQuery
*/
public function setHydrationCacheProfile(QueryCacheProfile $profile = null)
{
if ( ! $profile->getResultCacheDriver()) {
$profile = $profile->setResultCacheDriver($this->_em->getConfiguration()->getResultCacheImpl());
}
$this->_hydrationCacheProfile = $profile;
return $this;
}