• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest opcache isn't invalidated when saving template

Jake B.

Well-known member
When you save a template and are using the 'render templates from files' option it can take quite a bit of time before the changes actually render due to the OpCache. You can use opcache_invalidate to invalidate specific files so the change will be more immediate


Well-known member
opcache_invalidate only exists for PHP > 5.5.0. XenForo works for older PHP versions too. Have you tried turning on the opcache.revalidate_timestamps directive? This should work for all PHP versions.

Chris D

XenForo developer
Staff member
Going to go ahead and call this a suggestion for now.

We could, of course, only conditionally run it if the method exists but bear in mind there are other workarounds and also older and different opcache systems that have been affected by similar issues which wouldn't be affected by this change.

For development I switch it off in config.php (or php.ini of course):
@ini_set('opcache.revalidate_freq', 0);
For a live site, have opcache.validate_timestamps switched on, but have opcache.revalidate_freq at a reasonable figure. The default is 2 seconds. I've seen some setups have this as high as 120! That's pretty extreme, but 1-2 seconds seems reasonable to me. By the time the changes have been made, the template re-compiled and you going to check the changes, it should have revalidated by then on its own.