結果キャッシュを利用して、Doctrine 2.0 を使用するアプリケーションのパフォーマンスを改善しようとしています。
クエリの setResultCacheImpl() と useResultCache(true) は、キャッシュとして APC で使用されます。
デバッグ\Doctrine\ORM\AbstractQuery->execute
が呼び出されていることがわかりますが、キャッシュされたデータは見つかりません。理由は$cached[$id]
、データがキャッシュから読み取られるときに設定されないためです。以下のDoctrineコードを見ると、どのよう$cached[$id]
に設定すべきかわかりません:
// Check result cache
if ($this->_useResultCache && $cacheDriver = $this->getResultCacheDriver()) {
list($id, $hash) = $this->getResultCacheId();
$cached = $this->_expireResultCache ? false : $cacheDriver->fetch($id);
if ($cached === false || !isset($cached[$id])) {
// Cache miss.
$stmt = $this->_doExecute();
$result = $this->_em->getHydrator($this->_hydrationMode)->hydrateAll(
$stmt, $this->_resultSetMapping, $this->_hints
);
$cacheDriver->save($id, $result, $this->_resultCacheTTL);
return $result;
} else {
// Cache hit.
return $cached[$id];
}
}
何か案が?