-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unreliable cache availability check #4
Comments
@sutem that is the expected behaviour. You are supposed the clean up cached file and the opcache when deploying a new version. |
@lcobucci I completely agree with you. But this is not about deploy. In this situation, we need to be sure that deleting the cache file will trigger the creation of a new one. |
I don't follow... Is this for development environment? If so, why do have caching enabled? |
What I'm trying to say is that include can return a file even if it was deleted, because it remains in the php cache. To prevent this unexpected behavior, you should use file_exists and only then include the file. |
That suggestion implies in having extra and unnecessary io calls. This process is optimised for production environments, if you want to have manual interventions to remove the file you should also take the responsibility for cleaning up the opcache. Alternatively, you may decide not to use cache which will always give you the updated version of routes. Does this make sense to you? |
I don't think it's too scary php-bench
Clearing opcache is an incorrect option, because the application will depend on the caching technology used.
This is also not suitable, because it greatly affects performance.
I just want others to save time when they encounter my problem, because it is not as simple as it seems. I solved my local problem, but it occurred because the current implementation of the method does ignore php opcode caching. |
Hello @sutem, you could also use the If we want to add this as an optional feature we must also check that php opcode cache (and not a different kind of opcode caching) is enabled. kind regards |
mezzio-fastroute/src/FastRouteRouter.php
Line 494 in 9fc90f8
The file can be deleted, but its cached in opcache. I think it's better to check through the
file_exists
.The text was updated successfully, but these errors were encountered: