-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug
I found that when the class-loader-cache is created, it isn't refreshing when new (or existing) classes are created/changed. I found instances where my cache was over 2 weeks old despite many changes performed to related classes.
My solve for this was to SFTP into my WP Engine hosted server and manually delete the class-loader-cache directory to ensure it grabs the latest changes.
This results in scenarios of "works locally but not on my servers". I think this issue stems out of iterative deployments. One scenario in my testing, it worked just fine, but it was a server that we hadn't deployed any of the work to yet before any caches were created. If a cache exists and you adjust something in the autoloaded classes, the cache doesn't pick those up.
Ideally there is a mechanism to manually refresh that cache or it auto refreshes when it detects that a class has been modified. I did see the const to skip cache which will be really helpful in debugging this in the future, but ideally we have a reliable source to auto refresh it along with a manual refresh option.
Steps to Reproduce
- Create a new class using the ModuleInterface and deploy to your server.
- Make some changes that you can observe either from the front or backend (both affected) and deploy.
- Double check if your changes can be observed and double check the last modified date of the
class-loader-cacheand your autoloaded classes. - If the changes aren't showing up due to the cache, deleting the
class-loader-cachewill fix the issue.
Screenshots, screen recording, code snippet
Observe the last modified dates not in alignment. This reflects the effect of the site working in a past state despite all the files being up to date.
Environment information
Myself and another co-worker reported this issue on WP Engine hosted sites so unsure this is relevant at all. There is a thread in the company slack around this.
WordPress information
WordPress 6.8.3
Code of Conduct
- I agree to follow this project's Code of Conduct