Issue Type: Bug Created: 2008-11-19T05:29:06.000+0000 Last Updated: 2008-11-26T01:04:49.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)
Reporter: Zoran Lazic (zoki) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate
Related issues: Attachments:
When using cache on the Zend_Translate it seems to be writing to cache all the time although it has saved and valid cache. I'm using Core as front cache and Memcached as backend cache;
This is just a part of logged flow of cahce read and save - CACHE READ ID Zend_Translate_Gettext_Options - CACHE SAVED ID Zend_Translate_Gettext_Options - CACHE SAVED ID Zend_Translate_Gettext_Options - CACHE SAVED ID Zend_Translate_Gettext_Options
When translation adapter gets instanced the cache gets read inside constructor but some methods get also invoked that unconditionally write down the same cache that was previously read.
Posted by Thomas Weidner (thomas) on 2008-11-19T14:09:04.000+0000
Without any additional data there is no way to reproduce this behaviour of your environment.
Actually the options cache is only wrote in two places:
As you gave no details there can actually no failure be located.
Posted by Thomas Weidner (thomas) on 2008-11-19T14:12:55.000+0000
Multi cache access for example possible by using file search or adding files.
Posted by Zoran Lazic (zoki) on 2008-11-20T00:48:28.000+0000
Well this is the code that wirtes that Options into cache.
<pre class="literal">$lngPath = '/path/to/languages/en_US/LC_MESSAGES/global.mo'; $cacheDir = '/path/to/writable/cache'; $frontendOptions = array( 'lifetime' => 7200, 'automatic_serialization' => true, //'logging' => true, ); $backendOptions = array( 'cache_dir' => $cacheDir, ); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); Zend_Translate::setCache($cache); $translate = new Zend_Translate('gettext', $lngPath, 'en');
Constructor of the Zend_Translate_Adapter class reads options from the cache (let's say this is second run and there is something in the cache). Then it calls setLocale() method. setLocale() writes down the same options to cache again. addTranslation() does similar things ...
MY ZF version is 1.7.0 downloaded from the site.
Posted by Thomas Weidner (thomas) on 2008-11-20T08:56:18.000+0000
A small change has been made with r12713 which will write to cache only when the options differs from before even if setOption is called.
Still, it is not possible to erase this behaviour completly because files are searched through when using directory search and the options are changed dynamically. This will always lead to a cache save.
Have you found an issue?
See the Overview section for more details.