akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
955 stars 517 forks source link

php app/console cache:clear doesn't clear app/cache? #3466

Closed paul-cla closed 8 years ago

paul-cla commented 9 years ago

Should php app/console cache:clear clear the content of the app/cache folder?

After making changes to the routing files (src/Pim/Bundle/WebServiceBundle/Resources/config/routing.yml and src/Pim/Bundle/WebServiceBundle/Controller/Rest/ProductController.php) and they did not work until I ran rm -rf app/cache/*.

Is this expected?

jmleroux commented 9 years ago

php app/console cache:clear will not clear all the cache : for example, without the env parameter, i will clear you dev cache. For prod, you must specify the environment : php app/console cache:clear --env=prod Anyway, when i'm working on dev, i found it faster and easier to clear cache manually with rm

paul-cla commented 9 years ago

Sorry copy and paste let me down there - I did do env=dev and it didn't make any difference. I'll use rm if that tends to be easier!

sagikazarmark commented 9 years ago

This is actually a symfony feature, not really belongs to akeneo.

First of all: simply invoking the cache clear commans runs in dev environment by default, so adding it in the command only make sense, if you have SYMFONY_ENV environment variable defined to be something else.

Secondly, the cache clear command does warmup as well. This is the intended behaviour, because otherwise during the first page load symfony warms up the cache. In case of a heavy application (like akeneo) this might end up the process being stopped because of memory issues. So don't be surprised if you have files in the cache after clear.

If you think you have cache issues (something is not updated), try restarting your webserver. You might have opcode cache enabled. However, it should be disabled in development environment.

jmleroux commented 9 years ago

Exact @sagikazarmark , opcode IS enabled by the use of apcu extension. This is a cache where the doctrine metadata are stored and that's why you may need to restart apache.

sagikazarmark commented 9 years ago

There are already existing solutions (mean: hacks) to clear opcode cache from the application. The problem is that opcode is handled separately for different sapis, this simply invalidating from the console is not enough. (At least it is true for Zend Opcache, can't say for sure for apcu).