0

結果キャッシュを利用して、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];
        }
    }

何か案が?

4

1 に答える 1

0

この問題を修正するには、Doctrine 2.0.x リポジトリから修正を適用する必要があります: https://github.com/doctrine/doctrine2/commit/4271706cabdf6f7a99ffbe6aad0efcec1584f562

于 2013-08-05T13:08:34.073 に答える