Commit 14dbe3f7 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DDC-217 - Keep QueryCacheProfile as value object but add methods to evolve

parent f56fef02
......@@ -22,6 +22,8 @@ namespace Doctrine\DBAL\Cache;
/**
* Query Cache Profile handles the data relevant for query caching.
*
* It is a value object, setter methods return NEW instances.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class QueryCacheProfile
......@@ -97,4 +99,31 @@ class QueryCacheProfile
}
return array($cacheKey, $realCacheKey);
}
/**
* @param Cache $cache
* @return QueryCacheProfile
*/
public function setResultCacheDriver(Cache $cache)
{
return new QueryCacheProfile($this->lifetime, $this->cacheKey, $cache);
}
/**
* @param string|null $cacheKey
* @return QueryCacheProfile
*/
public function setCacheKey($cacheKey)
{
return new QueryCacheProfile($this->lifetime, $cacheKey, $this->resultCacheDriver);
}
/**
* @param int $lifetime
* @return QueryCacheProfile
*/
public function setLifetime($lifetime)
{
return new QueryCacheProfile($lifetime, $this->cacheKey, $this->resultCacheDriver);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment