-
Bug
-
Resolution: Fixed
-
Blocker
-
2.4.1, 2.5
-
MOODLE_24_STABLE, MOODLE_25_STABLE
-
MOODLE_24_STABLE
-
wip-
MDL-37545-m25 -
-
Difficult
-
As quoted from David Mudrak's comment on MDL-34224:
Sam, I have a question for you. While working on
MDL-34401I am trying to implement a cache to be used inside get_plugin_list(). According to my experiments, it decreases the Wall time spent in this function (as measured by xhprof) significantly. Using an ad-hoc cache worked great. So I wanted to convert it to a cache with proper definition. But ... The problem is that get_plugin_list() is called very early in the setup process and I can't find a way how to detect the case that the cache's description has not been registered yet. I am suspecting we will need to completely disable the whole MUC immediately after we realize that
if ($version > $CFG->version) { // upgrade
in admin/index.php.
In other words, my problem is that I have a code
$cache = cache::make('core', 'pluginlist');
that gets called before the core registers the description of this cache (simply because the cache API uses this function while it's looking for descriptions...).
Any ideas?
This highlights an issue within the cache API.
Internally it uses the plugin API in order to find definitions presented by plugins.
A very necessary procedure.
David above was looking to implement a plugins cache, a cache that would be very worth while. Because the cache uses the plugins API internally during initialisation unfortunately he ends up in a state where the cache get stuck in a loop continually trying to reinitialise itself.
The problem comes because part way through the initialisation the plugins API is called, the plugins API makes a cache and as part of that process we try to initialise again.
The solution to this I believe is to make use of an ad-hoc cache if a cache has been requested that we don't know about while the cache API itself is currently initialising.
In order to implement this we'll need a new state "updating" and better handling of requests to create a cache (this is where initialisation starts to happen).