I need to clear my doctrine's cache in Symfony.
There must be some way in command line for clear the cache.
Or where should I find and delete the files belonging to cache?
From the Doctrine command line you can run the following commands: To clear the query cache use the orm:clear-cache:query task. To clear the metadata cache use the orm:clear-cache:metadata task. To clear the result cache use the orm:clear-cache:result task.
Doctrine Cache is a library that provides an interface for caching data. It comes with implementations for some of the most popular caching data stores.
For Symfony 3+:
php bin/console
will list all commands, the following are relevant for cache:
php bin/console doctrine:cache:clear-metadata php bin/console doctrine:cache:clear-query php bin/console doctrine:cache:clear-result
Before Symfony 3:
app/console
will list how you can do it
app/console doctrine:cache:clear-metadata app/console doctrine:cache:clear-query app/console doctrine:cache:clear-result
If you want to do it within your code (from Doctrine's documentation) :
If you simply want to delete all cache entries you can do so with the deleteAll() method.
$cacheDriver = new \Doctrine\Common\Cache\ArrayCache(); $deleted = $cacheDriver->deleteAll();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With