Closed andrepereiradasilva closed 3 years ago
Looks fine to me. Just know you don't need XCache support on PHP 7+ as the extension hasn't been updated in years.
Is there a reason this has not resulted into an PR against this repo?
So, something like this called at every changed php file, maybe could do the job:
Just to be sure should we only do this on PHP files? And the other way around should we implement extension based special things into this package?
The filesystem package does not actively support any caching. Thus this package is not the right place to handle cache invalidation. Also, the proposed approach would force us to add every known and not yet known cache solution to the purgeFileFromOpCodeCache()
method, violating the Open Closed Principle (the O in SOLID).
However, the use case might be valuable. The right way to approach this is to add events to this package, so other services can react on them. But that's a bigger story that deserves its own RfC.
Request For Comments
Hi!
As we all know, php 7.x ships with opcache. It would be nice if the filesystem library invalidates the opcache files whenever there is an operation that changes the op code cached content.
I personaly don't like opcache_reset since AFAIK it resets the cache for all php instance (which can have multiple sites/application hosted), so probably the opcache_invalidate (and alternatives caching) could be a better alternative.
This process actually happens in joomla core restore part https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_joomlaupdate/restore.php#L8315 but AFAIK does exist in joomla as a whole.
Unless i'm missing something (which is probable ...) adding a method like this to the filesystem framework package and purging the opcache on php file overwrite would allow for a more agressive opcahing server config with joomla, and thus better joomla performance.
Example of more agressive opcaching:
http://php.net/manual/en/opcache.configuration.php
So, something like this called at every changed php file, maybe could do the job: