Just what the subject says - when does PHP's opcache re-parse a file? Is it based on file timestamp, or file hash or what?
Edit: If my question is not clear then I'll try again:) Say a file "xyz.php" is already in OPCache. Now I modify the file - and it obviously has to be parsed again and updated in the cache. How PHP knows it should do it?
It is based on your opcache configuration in your php.ini file.
opcache.revalidate_freq - Basically put, how often (in seconds) should the code cache expire and check if your code has changed. 0 means it checks your PHP code every single request (which adds lots of stat syscalls). Set it to 0 in your development environment. Production doesn't matter because of the next setting.
opcache.validate_timestamps - When this is enabled, PHP will check the file timestamp per your opcache.revalidate_freq
value.
When it's disabled, opcache.revaliate_freq
is ignored and PHP files are NEVER checked for updated code. So, if you modify your code, the changes won't actually run until you restart or reload PHP.
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