Skip to content

Commit

Permalink
[DDC-1766] Add usage of default result cache driver, add more docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Apr 4, 2012
1 parent fd2a22b commit c32a77e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Doctrine/ORM/AbstractQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,24 @@ public function setResultSetMapping(Query\ResultSetMapping $rsm)
/**
* 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;
}
Expand Down

0 comments on commit c32a77e

Please sign in to comment.