/** * Execute a caching query and * * @param string $query * @param array $params * @param array $types * @param QueryCacheProfile $qcp * @return \Doctrine\DBAL\Driver\ResultStatement */ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qcp) { $resultCache = $qcp->getResultCacheDriver() ?: $this->_config->getResultCacheImpl(); if (!$resultCache) { throw CacheException::noResultDriverConfigured(); } list($cacheKey, $realKey) = $qcp->generateCacheKeys($query, $params, $types); // fetch the row pointers entry if ($data = $resultCache->fetch($cacheKey)) { // is the real key part of this row pointers map or is the cache only pointing to other cache keys? if (isset($data[$realKey])) { return new ArrayStatement($data[$realKey]); } else { if (array_key_exists($realKey, $data)) { return new ArrayStatement(array()); } } } return new ResultCacheStatement($this->executeQuery($query, $params, $types), $resultCache, $cacheKey, $realKey, $qcp->getLifetime()); }