How to clear APC Doctrine cache for production?

I have this problem when I add a column to one of my entities and release it for production. I have to restart Apache to clear the Doctrine APC / APCU metadata.

I tried all the commands below, but no one worked for me:

php -r "apc_clear_cache();"
php -r "apcu_clear_cache();"

sudo php app/console doctrine:cache:clear-metadata
sudo php app/console doctrine:cache:clear-query
sudo php app/console doctrine:cache:clear-result

I get this error message for --env = prod

sudo php app/console doctrine:cache:clear-metadata  --env=prod
sudo php app/console doctrine:cache:clear-query  --env=prod
sudo php app/console doctrine:cache:clear-result --env=prod

 [LogicException]
  Cannot clear APC Cache from Console, its shared in the Webserver memory and not accessible from the CLI.

The only way I can update it. The Doctrine cache is to restart my Apache server, which may someday be a problem.

My cache settings for Doctine in my Symfony project:

doctrine:
    orm:
        metadata_cache_driver: apc
        result_cache_driver: apc
        query_cache_driver: apc
        second_level_cache:
            enabled: true
            log_enabled: false
            region_cache_driver: apc

How can I clear the APC cache in this case without restarting Apache every time I release a new schema update for production. This is even worse if you have many servers behind a load balancer.

+4
4

, , .php.

, app.php:

//apcu_clear_cache ();

, . .

0

Smart-Core/AcceleratorCacheBundle PHP Accelerator CLI.

cli :

php app/console cache:accelerator:clear

Capifony.

0

apc_clear_cache(); cli, . - , :

http://example.com/apc_cache_clear.php

0

, Php, Apache ( Nginx), Php, , 2 Linux, .

, CLI, php Apache.

apcu_clear_cache Symfony, Apache Php CLI.

, http://gordalina.imtqy.com/cachetool/, .

0

Source: https://habr.com/ru/post/1657409/


All Articles