Browse Source

Fix issue with cache groups when creating a cache engine

If a cache engine is configured by passing in a already constructed instance, any potential groups used by that engine are lost. This can have dire consequences when trying to call (for example), `Cache::groupConfigs()`. I noticed this problem with DebugKit's cache spies.
Walther Lalk 9 years ago
parent
commit
977ad6b81d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Cache/Cache.php

+ 4 - 0
src/Cache/Cache.php

@@ -153,6 +153,10 @@ class Cache
         $config = static::$_config[$name];
         $registry->load($name, $config);
 
+        if ($config['className'] instanceof CacheEngine) {
+            $config = $config['className']->config();
+        }
+
         if (!empty($config['groups'])) {
             foreach ($config['groups'] as $group) {
                 static::$_groups[$group][] = $name;