I have created a fix for this issue. It does not solve the naming problem, but it does allow for the custom naming and autoloading arguments to be passed to the Zend_Cache::factory call. That way you can at least explicitly create that backend.
Index: tests/Zend/Application/Resource/CacheManagerTest.php
===================================================================
— tests/Zend/Application/Resource/CacheManagerTest.php (revision 21970)
+++ tests/Zend/Application/Resource/CacheManagerTest.php (working copy)
@@ -182,6 +182,31 @@
$cache = $manager->getCache('foo');
$this->assertTrue($cache instanceof Zend_Cache_Core);
}
+
+ public function testNamespacedBackend()
+ {
+ $options = array(
+ 'foo' => array(
+ 'frontend' => array(
+ 'name' => 'Zend_Cache_Core',
+ 'options' => array(
+ 'lifetime' => 7200,
+ 'customFrontendNaming' => true
+ ),
+ ),
+ 'backend' => array(
+ 'name' => 'Zend_Cache_Backend_ZendServer_Disk',
+ 'options' => array(
+ 'customBackendNaming' => true
+ )
+ ),
+ ),
+ );
+ $resource = new Zend_Application_Resource_Cachemanager($options);
+ $manager = $resource->init();
+ $cache = $manager->getCache('foo')->getBackend();
+ $this->assertTrue($cache instanceof Zend_Cache_Backend_ZendServer_Disk);
+ }
}
if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_CacheManagerTest::main') {
Index: library/Zend/Cache/Manager.php
===================================================================
--- library/Zend/Cache/Manager.php (revision 21970)
+++ library/Zend/Cache/Manager.php (working copy)
@@ -171,7 +171,10 @@
$this->_optionTemplates[$name]['frontend']['name'],
$this->_optionTemplates[$name]['backend']['name'],
isset($this->_optionTemplates[$name]['frontend']['options']) ? $this->_optionTemplates[$name]['frontend']['options'] : array(),
- isset($this->_optionTemplates[$name]['backend']['options']) ? $this->_optionTemplates[$name]['backend']['options'] : array()
+ isset($this->_optionTemplates[$name]['backend']['options']) ? $this->_optionTemplates[$name]['backend']['options'] : array(),
+ isset($this->_optionTemplates[$name]['frontend']['options']['customFrontendNaming']) ? $this->_optionTemplates[$name]['frontend']['options']['customFrontendNaming'] : false,
+ isset($this->_optionTemplates[$name]['backend']['options']['customBackendNaming']) ? $this->_optionTemplates[$name]['backend']['options']['customBackendNaming'] : false,
+ isset($this->_optionTemplates[$name]['backend']['options']['autoload']) ? $this->_optionTemplates[$name]['backend']['options']['autoload'] : false
);
return $this->_caches[$name];
}
Index: library/Zend/Cache.php
===================================================================
— library/Zend/Cache.php (revision 21970)
+++ library/Zend/Cache.php (working copy)
@@ -143,6 +143,7 @@
}
if (!$autoload) {
$file = str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
+
if (!(self::_isReadable($file))) {
self::throwException("file $file not found in include_path");
}
I have created a fix for this issue. It does not solve the naming problem, but it does allow for the custom naming and autoloading arguments to be passed to the Zend_Cache::factory call. That way you can at least explicitly create that backend.
Index: tests/Zend/Application/Resource/CacheManagerTest.php
===================================================================
— tests/Zend/Application/Resource/CacheManagerTest.php (revision 21970)
+++ tests/Zend/Application/Resource/CacheManagerTest.php (working copy)
@@ -182,6 +182,31 @@
$cache = $manager->getCache('foo');
$this->assertTrue($cache instanceof Zend_Cache_Core);
}
+
+ public function testNamespacedBackend()
+ { + $options = array( + 'foo' => array( + 'frontend' => array( + 'name' => 'Zend_Cache_Core', + 'options' => array( + 'lifetime' => 7200, + 'customFrontendNaming' => true + ), + ), + 'backend' => array( + 'name' => 'Zend_Cache_Backend_ZendServer_Disk', + 'options' => array( + 'customBackendNaming' => true + ) + ), + ), + ); + $resource = new Zend_Application_Resource_Cachemanager($options); + $manager = $resource->init(); + $cache = $manager->getCache('foo')->getBackend(); + $this->assertTrue($cache instanceof Zend_Cache_Backend_ZendServer_Disk); + }
}
if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_CacheManagerTest::main') { Index: library/Zend/Cache/Manager.php =================================================================== --- library/Zend/Cache/Manager.php (revision 21970) +++ library/Zend/Cache/Manager.php (working copy) @@ -171,7 +171,10 @@ $this->_optionTemplates[$name]['frontend']['name'], $this->_optionTemplates[$name]['backend']['name'], isset($this->_optionTemplates[$name]['frontend']['options']) ? $this->_optionTemplates[$name]['frontend']['options'] : array(), - isset($this->_optionTemplates[$name]['backend']['options']) ? $this->_optionTemplates[$name]['backend']['options'] : array() + isset($this->_optionTemplates[$name]['backend']['options']) ? $this->_optionTemplates[$name]['backend']['options'] : array(), + isset($this->_optionTemplates[$name]['frontend']['options']['customFrontendNaming']) ? $this->_optionTemplates[$name]['frontend']['options']['customFrontendNaming'] : false, + isset($this->_optionTemplates[$name]['backend']['options']['customBackendNaming']) ? $this->_optionTemplates[$name]['backend']['options']['customBackendNaming'] : false, + isset($this->_optionTemplates[$name]['backend']['options']['autoload']) ? $this->_optionTemplates[$name]['backend']['options']['autoload'] : false ); return $this->_caches[$name]; }
Index: library/Zend/Cache.php
===================================================================
— library/Zend/Cache.php (revision 21970)
+++ library/Zend/Cache.php (working copy)
@@ -143,6 +143,7 @@
}
if (!$autoload) {
$file = str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
+
if (!(self::_isReadable($file))) { self::throwException("file $file not found in include_path"); }