Symfony app/console cache:clear --env=prod and cache (APC, Memcached, etc)? Symfony app/console cache:clear --env=prod and cache (APC, Memcached, etc)? symfony symfony

Symfony app/console cache:clear --env=prod and cache (APC, Memcached, etc)?


cache:clear

The cache:clear command doesn't clear the Doctrine caches. It only clears some Symfony 2 framework specific caches, mainly the app/cache (or var/cache) directories.

Doctrine commands

In order to clear the Doctrine caches, use:

  • doctrine:cache:clear-metadata --env=prod
  • doctrine:cache:clear-query --env=prod
  • doctrine:cache:clear-result --env=prod

Additional caches

If you use additional cache stores, you'll have to clear them yourself. You can look at the doctrine:cache:clear-* commands to get inspired on how to create your own command.

But looking at you configuration, you use a single cache store for the 3 Doctrine caches and Symfony Validator cache. So calling just one of the doctrine:cache:clear-* should clear everything.

Off topic

When using a cache system like APC, OPcache, and maybe others, you'll have to understand that when you run a PHP script from the command line, a different memory space is used then when running a PHP script from a webserver.

In other words: when you clear such caches from the command line, the caches used by the webserver are not affected. In order to clear the webserver caches, you'll need to run the cache clear script(s) from the webserver itself.

This is not an issue for memcached, because it's a separate program managing its own memory space.


You have to clear external cache yourself, from the doc (SF 2.5):

There may be lots of other things that you need to do, depending on your setup: [...] Clearing your APC cache

See: http://symfony.com/doc/current/cookbook/deployment/tools.html#e-other-things


This command do not clears the Memcache since it is a standalone distributed memory cacher.It clears the Symfony cache only.To clear the memcache you have to run manually :

echo 'flush_all' | nc localhost 11211

But I think you know that already.