Issues

ZF-11039: Problem using customBackendNaming with Zend_Cache_Manager

Description

You can't use Cache classes with customBackendNaming in the Zend_Cache_Manager because its getCache method calls Zend_Cache:factor without passing customFrontendNaming and customBackendNaming parameters. It should be

$this->_caches[$name] = Zend_Cache::factory( $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]['frontend']['customFontendNaming']) ? $this->_optionTemplates[$name]['frontend']['customFontendNaming'] : false , isset($this->_optionTemplates[$name]['backend']['customBackendNaming']) ? $this->_optionTemplates[$name]['backend']['customBackendNaming'] : false );

This allow you to configure the cache in application.ini like

resources.cachemanager.config.backend.name=Zend_Cache_Backend_ZendServer_ShMem resources.cachemanager.config.backend.customBackendNaming=true

A ready made temple for the ZendServer backends would be even better, allowing you to do just resources.cachemanager.config.backend.name=ZendServer_ShMem

Comments

@bill Not was described no information essential to reproduce bug. I see this issue but how an improvement.

Greetings Ramon

Using customBackendNaming or customFrontendNaming with cachamanager works in 1.11.3. Update your ZF !

If someone could close this issue..

The bug still exists in 1.11.4.

The parameters customFrontendNaming and customBackendNaming are still ignored in the _mergeOptions Method in the Zend_Cache_Manager class.

To fix this issue, i had to add the following lines in this method:


        if (isset($options['frontend']['customFrontendNaming'])) {
            $current['frontend']['customFrontendNaming'] = $options['frontend']['customFrontendNaming'];
 }
 if (isset($options['backend']['customBackendNaming'])) {
            $current['backend']['customBackendNaming'] = $options['backend']['customBackendNaming'];
 }

a solution for this problem (it solve my problem), it needs tests for others situations

I can confirm this bug still exists in 1.11.9 and that Markus's fix above works.

To replicate if you are using Zend Server (CE or standard) add the following to your application.ini:

resources.cachemanager.default.frontend.name                            = Core
resources.cachemanager.default.frontend.options.lifetime                = 5
resources.cachemanager.default.frontend.options.automatic_serialization = true
resources.cachemanager.default.frontend.customFrontendNaming            = false
resources.cachemanager.default.backend.name                             = ZendServer_ShMem
resources.cachemanager.default.backend.customBackendNaming              = true

On a side note if the file Zend/Cache/Backend/ZendServer/ShMem.php was renamed to Shmem.php I would guess we wouldn't need to set the customBackendNaming on Linux environments? Not tested