If I issue a basic query (with the default symfony & doctrine configuration) like
$em->getRepository(MyEntity::class)->findAll()
is this cached in any way???
1.1 What about
$queryBuilder->...->getResult()
? without touching->useXXXCache()
, is this cached?1.2 So, do I understand correctly that caching only is enabled via
$queryBuilder->...->useXXXCache()->getResult()
?Per default, all 3 caches (metadata, query and result) are set to
array
. This means, each new request has it's own cache.Ok, so if I use this setting, and do not perform any flushes and persists during a request that uses cached queries, then I can be sure that I will never get outdated results ? Because writes take place in an other request.
Is there a possibility to use a cache (result or query) by default? So to not having to set
$query->useResultCache(true)
?