I see, when you use a $cache object for $cache->start(), it becomes
something like zend cache front object, and cannot be used for anything
else.

But I wonder is it legal to use same $cache object for any other multiple
objects (except page caching) in the same time? Like;
$cache = Zend_Cache::factory('Core', 'File');
Zend_Date::setOptions(array('cache' => $cache));
Zend_Translate::setCache($cache);

Thank you for your patience in advance.

Cheers.


21 Kasım 2008 Cuma 10:01 tarihinde kirpit <[EMAIL PROTECTED]> yazdı:

> Hey, don't you offence my friend and no need triple exclamation marks like
> that. I'm just here trying to be developer who gives feedbacks about
> possible issues. Something like payback to usage of such a nice
> architectured and totally free, open source framework. Get it?
>
> First, of course sometimes i miss the parts of documantation but i do read
> documantation starting from this example;
>
> http://framework.zend.com/manual/en/zend.translate.adapter.html#zend.translate.adapter.caching
> which is using "Page" as cache frontend.in zend_translate.
>
> And second, please don't take this as complaining but i'm just wondering
> how is it working the same $cache object for zend_date right before
> zend_translate in bootstrap;
> Zend_Date::setOptions(array('cache' => $cache));
> (I'm not that low level programmer and didn't go through the ZF codes)
>
> If you want us to dig this mailing group only for "how to"s and never show
> up for the question marks, that is fine for me.
>
> 21 Kasım 2008 Cuma 09:12 tarihinde Thomas Weidner <[EMAIL PROTECTED]>yazdı:
>
>> Please read manual about how cache frontends work !!!
>>
>> You used "Page" as Cache frontend.
>> According to manual:
>> Zend_Cache_Frontend_Page is like Zend_Cache_Frontend_Output but designed
>> for a complete page. It's impossible to use Zend_Cache_Frontend_Page for
>> caching only a single block.
>>
>> Is there any reason why you want to have also the page input within the
>> same cache data as translation ?
>>
>> Of course this can not work when other data are also added to the
>> translation cache within the same cache id.
>>
>> This is definitly a problem of a misused cache.
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> ----- Original Message ----- From: "kirpit" <[EMAIL PROTECTED]>
>> To: <fw-general@lists.zend.com>
>> Sent: Friday, November 21, 2008 2:05 AM
>> Subject: [fw-general] Re: $cache->start() and caching with Zend_Translate
>> together, possible bug?
>>
>>
>>  Ok, what I do, I write here step by step.
>>>
>>> I have re-downloaded ZF 1.7. I removed everything under TEMP_DIR folder.
>>> I
>>> removed every single localhost cookie.
>>>
>>> I commented $cache->start(); line and uncommented
>>> Zend_Translate::setCache($cache); line. And I have entered main page.
>>> Everything looks very fine (while not cache hitting) and I have a file
>>> zend_cache--zend_translate_full_csv_file_path filled with correct
>>> translation table, serialized under temp dir next to some small metadata
>>> files.
>>>
>>> Then I removed again cookies and everything under temp dir. I comment
>>> translate cache and uncomment $cache->start(). There is no cache hit as
>>> expected. I do have fetched output in a file named zend_cache--someMd5
>>> but i
>>> do not have any cache file about zend_translation under temp dir as
>>> expected.
>>>
>>> I only remove cookies, leaving temp dir as it is. There is cache hit as
>>> expected and response time is 19ms (wow, here i adore ZF).
>>>
>>> I check cookies (well there is none as cache hits), remove files under
>>> temp
>>> folder. I uncomment both of them. Enter the mainpage. What i have under
>>> temp
>>> dir is a file named zend_cache--zend_translate_full_csv_file_path. And
>>> guess
>>> what is inside? Fetched and serialized html output of page! :)
>>>
>>> Yes, there is no any other file bigger than 1 kb. under temp.
>>>
>>> Bug?
>>>
>>> ---------- Yönlendirilmiş ileti ----------
>>> From: "Thomas Weidner" <[EMAIL PROTECTED]>
>>> To: <fw-general@lists.zend.com>
>>> Date: Thu, 20 Nov 2008 07:34:19 +0100
>>> Subject: Re: [fw-general] $cache->start() and caching with Zend_Translate
>>> together, possible bug?
>>> Sorry, but on the first look this seems to be a cache problem and not a
>>> translation one.
>>> Looking at the lines you provide I see that at line 435 the cache is
>>> loaded...
>>> $result = self::$_cache->load($id);
>>> which happens without problems.
>>>
>>> And then the cache is unserialized.
>>> unserialize($result);
>>> All translate classes are serializing the data before writing to cache so
>>> this can not be a problem.
>>>
>>> In my opinion there are only 4 things which can corrupt this behaviour.
>>>
>>> 1.) You are using an outdated cache after an update of ZF
>>> 2.) Someone writes manually to the translation cache without serializing
>>> the
>>> data
>>> 3.) Someone uses own written adapter which corrupt the cache
>>> 4.) You have a corrupted ZF version... try a update to fix the broken
>>> files
>>>
>>> Of course it could be that there is a problem in Zend_Cache itself, but I
>>> dont believe this, because your problem is thrown in unserialize. Why
>>> should
>>> Zend_Cache change the stored data. And Zend_Translate stores only
>>> serialized
>>> strings.
>>>
>>> Greetings
>>> Thomas Weidner, I18N Team Leader, Zend Framework
>>> http://www.thomasweidner.com
>>>
>>>
>>> 2008/11/20 kirpit <[EMAIL PROTECTED]>
>>>
>>>  Hi ZF people.
>>>>
>>>> I have following lines in bootstrap with ZF v1.7 running on php 5.2.6:
>>>>
>>>> ---------------------------------------->
>>>>
>>>> $cache = Zend_Cache::factory('Page', 'File', array(
>>>>  'lifetime' => 60 * 60 * 12,
>>>>  'regexps' => array(
>>>>  // cache whole indexController
>>>>  '^' . BASE_PATH . '$' => array(
>>>>  'cache' => true),
>>>>  // cache whole indexController
>>>>  '^' . BASE_PATH . 'index' => array(
>>>>  'cache' => true),
>>>>  // cache whole iController
>>>>  '^' . BASE_PATH . 'i/' => array(
>>>>  'cache' => true),
>>>>  // cache ajax/get-suggest
>>>>  '^' . BASE_PATH . 'ajax/get-suggest' => array(
>>>>  'cache' => true,
>>>>  'cache_with_get_variables' => true,
>>>>  'cache_with_session_variables' => true,
>>>>  'cache_with_cookie_variables' => true,
>>>>  'make_id_with_get_variables' => true,
>>>>  'make_id_with_session_variables' => false,
>>>>  'make_id_with_cookie_variables' => false))), array(
>>>>  'cache_dir' => TEMP_DIR));
>>>> $cache->start();
>>>>
>>>> // ... more later
>>>>
>>>> Zend_Translate::setCache($cache);
>>>> $translate = new Zend_Translate('csv', DOC_ROOT . 'language' . DS .
>>>> 'tr_TR.csv', 'tr_TR');
>>>> Zend_Registry::set('Zend_Translate', $translate);
>>>>
>>>> ---------------------------------------->
>>>>
>>>> And it produces following errors:
>>>>
>>>> Warning: unserialize() expects parameter 1 to be string, array given in
>>>> ...\Zend\Translate\Adapter.php on line 436
>>>>
>>>> Notice: No translation for the language 'tr_TR' available. in
>>>> ...\Zend\Translate\Adapter.php on line 307
>>>>
>>>> Notice: No translation for the language 'tr_TR' available. in
>>>> ...\Zend\Translate\Adapter.php on line 307
>>>>
>>>> Notice: No translation for the language 'tr_TR' available. in
>>>> ...\Zend\Translate\Adapter.php on line 307
>>>>
>>>> When I comment one of the cache feature, either $cache->start()
>>>> or Zend_Translate::setCache($cache); everything looks fine. I have found
>>>> similar bug below link but it says it is fixed already:
>>>> http://framework.zend.com/issues/browse/ZF-3930
>>>>
>>>> Could be a bug?
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to