Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Automated configuration file cache invalidation #62
Every time a configuration file (any xml file) or Service contract is created/edited/removed in Magento, the corresponding configuration cache has to be cleared manually. This degrades developer experience, and makes invalidations more expensive as all configuration types are reloaded when config cache is cleared.
External solutions for automated cache invalidation exist:
To improve developer experience without reliance on external tools and additional setup, the approach similar to Opcache can be used:
POC is implemented in https://github.com/magento-architects/magento2/tree/split-framework (see https://github.com/magento-architects/magento2/blob/split-framework/lib/internal/Magento/Framework/Config/Config/Loader.php) for
Use https://github.com/magento-architects/magento-project for easy installation of a "hello world" applciation.
Nice to see this in the core!
The following comments are regarding the POC implementation.
I'm wondering, is the
Also, I think I remember that apcu records can't be shared between php-fpm|mod_php and php-cli, so on CLI calls (e.g.
EDIT: Found this comment from the original acpu author:
The branch has different POCs for different proposals. Apcu is one of them - “Configuration-less cache for simplified config infrastructure”. I plan to publish it separately. Apcu cache was used to try it out. For purposes of this proposal you can just assume any cache adapter.
@Vinai, yes. Paths to check (both files and folders) are generated on line 71 of FileResolver. Then their timestamps are collected in Loader::loadAndCache (files that don't exist don't have a timestamp), then in Loader::getCachedContent files or folders that did not have timestamps but exist now trigger reload.
Thanks for the explanation, @antonkril.
Very cool, looking forward to this being applied to all config XML files in the core!