1
0
mirror of synced 2025-02-02 21:41:45 +03:00

The timestamp verification is now done by the validator

So it's useless to keep it here too.
This commit is contained in:
Luís Cobucci 2016-09-07 22:32:59 +00:00 committed by Marco Pivetta
parent b431332cef
commit dd476094af

View File

@ -287,17 +287,16 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
* @param array $orderBy * @param array $orderBy
* @param integer $limit * @param integer $limit
* @param integer $offset * @param integer $offset
* @param integer $timestamp
* *
* @return string * @return string
*/ */
protected function getHash($query, $criteria, array $orderBy = null, $limit = null, $offset = null, $timestamp = null) protected function getHash($query, $criteria, array $orderBy = null, $limit = null, $offset = null)
{ {
list($params) = ($criteria instanceof Criteria) list($params) = ($criteria instanceof Criteria)
? $this->persister->expandCriteriaParameters($criteria) ? $this->persister->expandCriteriaParameters($criteria)
: $this->persister->expandParameters($criteria); : $this->persister->expandParameters($criteria);
return sha1($query . serialize($params) . serialize($orderBy) . $limit . $offset . $timestamp); return sha1($query . serialize($params) . serialize($orderBy) . $limit . $offset);
} }
/** /**
@ -368,9 +367,8 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
} }
//handle only EntityRepository#findOneBy //handle only EntityRepository#findOneBy
$timestamp = $this->timestampRegion->get($this->timestampKey);
$query = $this->persister->getSelectSQL($criteria, null, null, $limit, null, $orderBy); $query = $this->persister->getSelectSQL($criteria, null, null, $limit, null, $orderBy);
$hash = $this->getHash($query, $criteria, null, null, null, $timestamp ? $timestamp->time : null); $hash = $this->getHash($query, $criteria, null, null, null);
$rsm = $this->getResultSetMapping(); $rsm = $this->getResultSetMapping();
$queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey); $queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey);
$queryCache = $this->cache->getQueryCache($this->regionName); $queryCache = $this->cache->getQueryCache($this->regionName);
@ -408,9 +406,8 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
*/ */
public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null) public function loadAll(array $criteria = array(), array $orderBy = null, $limit = null, $offset = null)
{ {
$timestamp = $this->timestampRegion->get($this->timestampKey);
$query = $this->persister->getSelectSQL($criteria, null, null, $limit, $offset, $orderBy); $query = $this->persister->getSelectSQL($criteria, null, null, $limit, $offset, $orderBy);
$hash = $this->getHash($query, $criteria, null, null, null, $timestamp ? $timestamp->time : null); $hash = $this->getHash($query, $criteria, null, null, null);
$rsm = $this->getResultSetMapping(); $rsm = $this->getResultSetMapping();
$queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey); $queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey);
$queryCache = $this->cache->getQueryCache($this->regionName); $queryCache = $this->cache->getQueryCache($this->regionName);
@ -511,8 +508,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
$limit = $criteria->getMaxResults(); $limit = $criteria->getMaxResults();
$offset = $criteria->getFirstResult(); $offset = $criteria->getFirstResult();
$query = $this->persister->getSelectSQL($criteria); $query = $this->persister->getSelectSQL($criteria);
$timestamp = $this->timestampRegion->get($this->timestampKey); $hash = $this->getHash($query, $criteria, $orderBy, $limit, $offset);
$hash = $this->getHash($query, $criteria, $orderBy, $limit, $offset, $timestamp ? $timestamp->time : null);
$rsm = $this->getResultSetMapping(); $rsm = $this->getResultSetMapping();
$queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey); $queryKey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL, $this->timestampKey);
$queryCache = $this->cache->getQueryCache($this->regionName); $queryCache = $this->cache->getQueryCache($this->regionName);