Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function loadCriteria(Criteria $criteria)
 {
     $query = $this->persister->getSelectSQL($criteria);
     $timestamp = $this->timestampRegion->get($this->timestampKey);
     $hash = $this->getHash($query, $criteria, null, null, null, $timestamp ? $timestamp->time : null);
     $rsm = $this->getResultSetMapping();
     $querykey = new QueryCacheKey($hash, 0, Cache::MODE_NORMAL);
     $queryCache = $this->cache->getQueryCache($this->regionName);
     $cacheResult = $queryCache->get($querykey, $rsm);
     if ($cacheResult !== null) {
         if ($this->cacheLogger) {
             $this->cacheLogger->queryCacheHit($this->regionName, $querykey);
         }
         return $cacheResult;
     }
     $result = $this->persister->loadCriteria($criteria);
     $cached = $queryCache->put($querykey, $rsm, $result);
     if ($this->cacheLogger) {
         if ($result) {
             $this->cacheLogger->queryCacheMiss($this->regionName, $querykey);
         }
         if ($cached) {
             $this->cacheLogger->queryCachePut($this->regionName, $querykey);
         }
     }
     return $result;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function loadCriteria(Criteria $criteria)
 {
     return $this->persister->loadCriteria($criteria);
 }