-
-
Notifications
You must be signed in to change notification settings - Fork 576
[5.x] Fix files not being removed after cache has been cleared #11873
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
[5.x] Fix files not being removed after cache has been cleared #11873
Conversation
Are you able to add a test for this? It can be added to |
I've added tests, only windows seems to fail. |
No problem - we can handle that, thanks! |
What you had was working on Windows, but the assertions weren't. There were inconsistencies with the directory separators. |
Thank you! 🚀 I expected something like that considering it's the only part checking a full file path instead of checking a virtual one |
This PR fixes the issue where url invalidation will no longer function after the cache has been cleared.
This is especially an issue when a cron is run that clears the application cache every so often.
When that happens the url cache keys will be removed, any kind of invalidation will no longer function.
This PR will use the recursiveDirectoryIterator functions to efficiently remove these files from disk if there are still some left over that were not in application cache.
Due to it being an iterator it's light on memory
Note: We could completely move to file based clearing instead of application cache. But for completeness, to keep other parts that might be watching the application cache in the loop i've decided to keep that as-is