Issues

ZF-11039: Problem using customBackendNaming with Zend_Cache_Manager

Issue Type: Bug Created: 2011-02-04T19:50:37.000+0000 Last Updated: 2012-02-26T06:17:50.000+0000 Status: Open Fix version(s): Reporter: bill (billsalvucci@gmail.com) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Cache

  • zf-crteam-review

Related issues: Attachments: - ZF-11039.patch

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

Posted by Ramon Henrique Ornelas (ramon) on 2011-02-05T22:03:18.000+0000

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

Greetings Ramon

Posted by Frederik Eychenie (feychenie) on 2011-02-27T16:56:35.000+0000

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

If someone could close this issue..

Posted by Markus Perl (_mex_) on 2011-03-29T08:49:45.000+0000

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:

<pre class="highlight">
        if (isset($options['frontend']['customFrontendNaming'])) {
            $current['frontend']['customFrontendNaming'] = $options['frontend']['customFrontendNaming'];
 }
 if (isset($options['backend']['customBackendNaming'])) {
            $current['backend']['customBackendNaming'] = $options['backend']['customBackendNaming'];
 }

Posted by Renan de Lima (renanbr) on 2011-05-26T15:03:55.000+0000

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

Posted by Alex Barnes (abarnes) on 2011-09-16T08:51:30.000+0000

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:

<pre class="literal">
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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts