Disable OPCache temporarily

前端 未结 4 641
迷失自我
迷失自我 2020-12-07 18:59

I recently moved to PHP 5.4 and installed OPCache, it\'s very powerful!

How can I temporarily disable the cache?

I tried :

 ini_set(\'opcache         


        
4条回答
  •  天命终不由人
    2020-12-07 19:16

    In my modest opinion, because I'm no expert, Jul has given the best answer. The question included the term "temporarily", so changing the configuration files I think... is not the best answer because you need to reconfigure, run what you want and reconfigure again to make it work normally.

    It's not smooth.

    With the answer of Jul you can modify the code to perform some action by disabling the opcache and return to a normal situation within the same code (although we would have to see how to re-enable from code the opcache)

    For example, with Prestashop, there can be problems cleaning the "normal" cache from the administration interface if opcache is enabled, so in that case you can use a method so that when the action is performed, opcache is disabled, the "normal" cache is cleaned, and then opcache is enabled again.

提交回复
热议问题