Devel.cz Lupa Měšec Podnikatel Root Zdroják.cz DigiZone Slunečnice Vitalia TopDrive KupDnes Navrcholu NovýTarif Dobrý web Weblogy Woko Jagg Computer.cz SK: MojeLinky

Hlavní navigace

Názor k článku
Doctrine 2: úvod do systému

Václav Novotný
26. 7. 2010 16:40

Kešování metadat entit

celé vlákno

Jen doplním, že se zde nekonfiguruje EntityManager s aktivním kešováním metadat entit a DQL dotazů. V dokumentaci se silně doporučuje toto nějakým způsobem kešovat.

Do not use Doctrine without a metadata and query cache! Doctrine is highly optimized for working with caches. The main parts in Doctrine that are optimized for caching are the metadata mapping information with the metadata cache and the DQL to SQL conversions with the query cache. These 2 caches require only an absolute minimum of memory yet they heavily improve the runtime performance of Doctrine. The recommended cache driver to use with Doctrine is APC. APC provides you with an opcode-cache (which is highly recommended anyway) and a very fast in-memory cache storage that you can use for the metadata and query caches as seen in the previous code snippet.

http://www.doctrine-project.org/projects/orm/2.0/docs/reference/configuration/en#bootstrapping:obtaining-an-entitymanager

Nejjednodušší na použití je \Doctrine\Com­mon\Cache\Arra­yCache, která se aktivuje takto:

$cache = new \Doctrine\Common\Cache\ArrayCache();
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);