Issues

ZF-3071: Add way to check for cache on basis of files

Description

When adding files afterwards they are always added even if they already exist in the cache. The cache should check if the file already exists and return imediatly instead of adding the file once more.

from the mailinglist: Rob,

just use directory or file search. Calling multiple times addTranslation is really depreciated. See into the manual for details.

Related to you request. It is called but not at the place you expected it. The data is written in the cache.

But when you add a new translation to the adapter using the same language as already existing there is no way to detect if the new file which shall be added is the same or another one. So we MUST overwrite existing data. Think of translations which exist in a module based layout. Each module adds new translations for the same language. When there is no way to add a translation because the language already exists, such a model would not work anymore.

Therefor when you do not work with a module based layout you should always work with directory search.

Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com

----- Original Message ----- From: "Rob L" roblacy@yahoo.com To: fw-general@lists.zend.com Sent: Monday, April 07, 2008 10:45 PM Subject: [fw-general] Zend_Translate doesn't cache when addTranslation is called

>

I wrote a custom adapter and am trying to load 13 different languages from files. I can't simply read the entire directory because I am using non-standard locale names and need full control. So in my bootstrap I call the Zend_Translate constructor for my first language and then call addTranslation for each of the remaining languages.

All of the languages get cached, but only the Zend_Translate constructor actually checks to see if a language has been cached. If you call addTranslation directly, it always calls the adapter to load the file.

For now as a workaround, I manually check to see if Zend_Cache already has the key 'Zend_Translate_[my adapter here]' cached. But really, Zend should simply check the cache for a hit every time addTranslation is called, right?

Rob

View this message in context: http://nabble.com/Zend_Translate-doesn%27t-cache-w… Sent from the Zend Framework mailing list archive at Nabble.com.

Comments

Added with r10915

Updating for the 1.6.0 release.