diff --git a/classes/cache_factory.php b/classes/cache_factory.php index 593afa7..5a2839f 100644 --- a/classes/cache_factory.php +++ b/classes/cache_factory.php @@ -53,14 +53,21 @@ public function create_config_instance($writer = false) { } } + $config = null; + if (!array_key_exists($class, $this->configs)) { // Create a new instance and call it to load it. // As part of generating store instance config we test the initialisation of stores. // Testing this may initialise DI, which will attempt to use cache for hookcallbacks. // Setting the state to initialising will make it use ad-hoc cache for that request. self::set_state(self::STATE_INITIALISING); - $this->configs[$class] = new $class; - $this->configs[$class]->load(); + $config = new $class(); + $config->load(); + + // Re-register after load in case anything reset $this->configs. + $this->configs[$class] = $config; + } else { + $config = $this->configs[$class]; } // We need the siteid in order to use the caches, but the siteid @@ -77,7 +84,7 @@ public function create_config_instance($writer = false) { } // Return the instance. - return $this->configs[$class]; + return $config; } /** diff --git a/version.php b/version.php index 6c9b941..57f9512 100644 --- a/version.php +++ b/version.php @@ -24,9 +24,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024093000; -$plugin->release = "2024093000"; -$plugin->requires = 2024092700; // Requires 4.5. +$plugin->version = 2024093001; +$plugin->release = "2024093001"; +$plugin->requires = 2024100700; // Requires 4.5. $plugin->component = 'tool_forcedcache'; // Full name of the plugin (used for diagnostics). $plugin->maturity = MATURITY_STABLE; $plugin->supported = [405, 405];