Reputation: 2766
When I execute the command php bin/console doctrine:ensure-production-settings
I have this result
query Cache uses a non-persistent cache driver, Doctrine\Common\Cache\ArrayCache.
Can someone explain what is this result and what I have to do?
Upvotes: 4
Views: 2070
Reputation: 564
in Symfony 3.4 (sample)
uncomment lines on config_prod.yml
doctrine:
orm:
metadata_cache_driver: apc
result_cache_driver: apc
query_cache_driver: apc
and use it without error
Upvotes: 1
Reputation: 8276
This simply means that you have no persistent cache set up for Doctrine queries. Doctrine uses a cache to convert DQL queries to SQL, so in a production environment it makes sense to cache this and not have to do that same work every time.
See here: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html#query-cache
The function that throws the Exception is here: https://github.com/doctrine/doctrine2/blob/2.5/lib/Doctrine/ORM/Configuration.php#L374
and the code looks like this:
if ($queryCacheImpl instanceof ArrayCache) {
throw ORMException::queryCacheUsesNonPersistentCache($queryCacheImpl);
}
What you should look to do is implement a caching mechanism on your production environment, whether it be APC, Memcache, Redis, etc.
Upvotes: 3