It is currently Sun Jul 20, 2008 11:02 am

Joom!Fish and cache enabled

How to support more than one language on your site.

Moderators: ot2sen, akede, ivo.apostolov, General Support Moderators

Joom!Fish and cache enabled

Postby array2001 on Tue Nov 14, 2006 4:15 pm

Hi, I am using Joomla 1.0.11 + JoomFish 1.7, and I'm having problems when I turn cache on. News are showed in the latest cached language (no matter what language you select). It only appears in the right language when cache expires..

The only workaround for this issue that I know is to turn cache off, but then the loading speed sucks.. Does anyone know of a fix for this issue?

Thanks!
  Raúl.
Last edited by RobInk on Tue Nov 21, 2006 12:54 pm, edited 1 time in total.
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby RobInk on Tue Nov 21, 2006 12:54 pm

Moderator note; topic split from tips/tricks topic.
Regards Robin // Sites & Infrastructure - JoomlaCode Admin - BugSquad Member

Spilling the Beans on Open Source - Case studies, Reviews, Interviews and more @ http://robink.nl
Latest post: http://robink.nl/2008/07/16/freedom-fun ... aboration/
User avatar
RobInk
Joomla! Master
Joomla! Master
 
Posts: 15383
Joined: Thu Aug 18, 2005 10:41 am
Location: The Netherlands

Re: Joom!Fish and cache enabled

Postby array2001 on Sun Nov 26, 2006 11:23 am

Thanks RobInk,

What I did is to change the Cache-Lite code to add a flag in the cache file names, thus the language is taken into account. This way the languages are not messed up when I turn on the Joomla cache.
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby pastoweb on Wed Dec 20, 2006 8:01 am

Could you explain us exactly what you modified and where? Please post the new code...
pastoweb
Joomla! Intern
Joomla! Intern
 
Posts: 81
Joined: Sun Nov 27, 2005 11:27 am

Re: Joom!Fish and cache enabled

Postby array2001 on Wed Dec 20, 2006 11:12 am

Sure, I am far from being a php coder, so the altered code is not probably the best approach, anyhow it works and as it is a really small change I didn't bother trying to get it better written.

The idea is to distinguish between languages in the cache generated files, so I have added a flag at the end of every cache file name: ENG for English piece of content, and ESP for Spanish piece of content:

Code: Select all
cache_94afbfb2f291e0bf253fcf222e9d238e_0a44f3ad03329c1101771b2cea700cb2_ENG
cache_94afbfb2f291e0bf253fcf222e9d238e_0a44f3ad03329c1101771b2cea700cb2_ESP


The code change in file includes/Cache/Lite.php is as follows:


Code: Select all
       
        function _setFileName($id, $group)
        {
                global $mosConfig_lang;

                if ($mosConfig_lang == english )
                {
                        $idioma = "_ENG";
                }
                if ($mosConfig_lang == spanishi )
                {
                        $idioma = "_ESP";
                }

                if ($this->_fileNameProtection) {
                        $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'.md5($id).$idioma);
                } else {
                        $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id.$idioma;
                }

        }


It is working now with cache on at http://www.conscious-robots.com
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby akede on Sun Jan 14, 2007 5:30 pm

Can you all check the latest Joomla! core 1.0.12 - we fixed something related to the cache.

Alex
Joomla! Core Events team lead
Check out Joom!Fish 2.0 Beta 2 your fully free multilingual solution for Joomla! 1.5 - check it out at http://www.joomfish.net
Think Network, Munich - http://www.ThinkNetwork.com
User avatar
akede
Joomla! Ace
Joomla! Ace
 
Posts: 1668
Joined: Fri Aug 12, 2005 6:15 am
Location: Munich, Germany

Re: Joom!Fish and cache enabled

Postby array2001 on Mon Jan 15, 2007 5:04 pm

I've upgraded my site to Joomla! Core 1.0.12 using the patch Joomla_1.0.11_to_1.0.12-Stable-Patch_Package.zip
This patch doesn't include any CacheLite file, so I see no change from 1.0.11..
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby akede on Mon Jan 15, 2007 6:09 pm

:( The changes we did wasn't in the CacheLite files but in the files that called this class.

Need to check
Joomla! Core Events team lead
Check out Joom!Fish 2.0 Beta 2 your fully free multilingual solution for Joomla! 1.5 - check it out at http://www.joomfish.net
Think Network, Munich - http://www.ThinkNetwork.com
User avatar
akede
Joomla! Ace
Joomla! Ace
 
Posts: 1668
Joined: Fri Aug 12, 2005 6:15 am
Location: Munich, Germany

Re: Joom!Fish and cache enabled

Postby array2001 on Mon Jan 15, 2007 9:31 pm

OK, so I removed the changes in CacheLite described in this thread, i.e. restored original CacheLite _setFileName function.
And I get a weird behaviour: if you go to a content page, it seems to work ok, whenever you switch the language you get the right translated content, however, if you go to the frontpage or a category/section page, the first cached language remains (language switching is not working).

I will keep the original CacheLite code for some hours so you can see it for yourself online at
http://www.conscious-robots.com
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby akede on Tue Jan 16, 2007 5:15 am

Ok we will try to hunt down what's the issue still. Thx for the feedback
Joomla! Core Events team lead
Check out Joom!Fish 2.0 Beta 2 your fully free multilingual solution for Joomla! 1.5 - check it out at http://www.joomfish.net
Think Network, Munich - http://www.ThinkNetwork.com
User avatar
akede
Joomla! Ace
Joomla! Ace
 
Posts: 1668
Joined: Fri Aug 12, 2005 6:15 am
Location: Munich, Germany

Re: Joom!Fish and cache enabled

Postby array2001 on Tue Jan 16, 2007 9:58 am

Thanks! I'll restore the _setFileName function trick for the time being..
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby ScannerD on Fri Jan 26, 2007 5:39 pm

And I thought I was going crazy... same problem here...
The lovely thing called multilingual Joomla! sites 

Turned off the caching... for the time being...  :'(

Hope you fix it soon...
ScannerD
Joomla! Fledgling
Joomla! Fledgling
 
Posts: 1
Joined: Fri Jan 26, 2007 5:34 pm

Re: Joom!Fish and cache enabled

Postby array2001 on Sun Feb 04, 2007 8:02 pm

Well, while you wait for an official fix, you could turn chache on and apply the _setFileName function patch as explained above.
This is what I did, and it is working fine for two languages.
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby mbreiden on Wed Feb 21, 2007 5:09 pm

array2001 wrote:
Sure, I am far from being a php coder, so the altered code is not probably the best approach, anyhow it works and as it is a really small change I didn't bother trying to get it better written.

The idea is to distinguish between languages in the cache generated files, so I have added a flag at the end of every cache file name: ENG for English piece of content, and ESP for Spanish piece of content:

Code: Select all
cache_94afbfb2f291e0bf253fcf222e9d238e_0a44f3ad03329c1101771b2cea700cb2_ENG
cache_94afbfb2f291e0bf253fcf222e9d238e_0a44f3ad03329c1101771b2cea700cb2_ESP


The code change in file includes/Cache/Lite.php is as follows:



I'm no php coder either, but instead of using the if statements I just changed the $idioma to $mosConfig_lang, so my section looks like:

Code: Select all
       
        function _setFileName($id, $group)
        {
                global $mosConfig_lang;

         
                if ($this->_fileNameProtection) {
                        $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'.md5($id).$mosConfig_lang);
                } else {
                        $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id.$mosConfig_lang;
                }

        }
mbreiden
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 8
Joined: Wed Feb 21, 2007 3:50 pm

Re: Joom!Fish and cache enabled

Postby array2001 on Wed Feb 21, 2007 5:28 pm

Cool, much more compact and elegant  ;) This way you don't need to alter the code again if you add additional languages... which was a problem of the code I sent originally.
Thanks mbreiden.
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby B3ll0 on Sun Mar 04, 2007 4:15 pm

10x guys for this  nice hack!  :o :D

A little change from me to include "_" before language descriptor: ;)

Code: Select all
   /**
   * Make a file name (with path)
   *
   * @param string $id cache id
   * @param string $group name of the group
   * @access private
   */
        function _setFileName($id, $group)
        {
                global $mosConfig_lang;

         
                if ($this->_fileNameProtection) {
                        $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_'.md5($id).'_'.$mosConfig_lang);
                } else {
                        $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id.'_'.$mosConfig_lang;
                }

        }

B3ll0
Joomla! Fledgling
Joomla! Fledgling
 
Posts: 1
Joined: Wed Dec 06, 2006 3:43 pm

Re: Joom!Fish and cache enabled

Postby gaupe on Sat Jul 21, 2007 10:51 am

Hmm i have implemented this on my website but found out there's still a sort of problem with the caching
(it is'nt there if you turn the cache off so it must be the cache that causes it.)

I checked it on the webite mentioned http://www.conscious-robots.com and it shows the same behaviour.

This is that if you click on a story and therewith open it in the main window. and then from there choose another language.
It, not allways, shows the same article but in many cases another (previous cached?) article....
I'm not sure what causes this nor do i know how to solve it, somebody any ideas?
User avatar
gaupe
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 16
Joined: Sat Jul 14, 2007 10:00 pm

Re: Joom!Fish and cache enabled

Postby gaupe on Sat Jul 21, 2007 7:27 pm

Well for me i installed Jaccelerator and this caching software seems to work flawless for me.
i see that it is language specific (in the cache files) i allso choose what to cache and what not so it is allso
much more customizable.
User avatar
gaupe
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 16
Joined: Sat Jul 14, 2007 10:00 pm

Re: Joom!Fish and cache enabled

Postby gesellix on Sat Jul 21, 2007 8:30 pm

gaupe wrote:Hmm i have implemented this on my website but found out there's still a sort of problem with the caching
(it is'nt there if you turn the cache off so it must be the cache that causes it.)

I checked it on the webite mentioned http://www.conscious-robots.com and it shows the same behaviour.

This is that if you click on a story and therewith open it in the main window. and then from there choose another language.
It, not allways, shows the same article but in many cases another (previous cached?) article....
I'm not sure what causes this nor do i know how to solve it, somebody any ideas?


it sems to me like the weird behaviour only (and always) comes when calling the main site, i.e. without "parameters".
did you try disabling your SEF component?
gesellix
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 35
Joined: Fri Sep 02, 2005 8:45 pm

Re: Joom!Fish and cache enabled

Postby gaupe on Sun Jul 22, 2007 6:32 pm

ah well like i said the moment i put in the jaccelerator the problem vanished.
can be that the sef has some to do with it i dont know but as i dont want to do without the sef (i want search engines to find my translations) it wont help me much if it would work without sef.

i now played with the site all day and with jaccelerator all is fine.
User avatar
gaupe
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 16
Joined: Sat Jul 14, 2007 10:00 pm

Re: Joom!Fish and cache enabled

Postby array2001 on Sun Jul 22, 2007 9:41 pm

gaupe wrote:Hmm i have implemented this on my website but found out there's still a sort of problem with the caching
(it is'nt there if you turn the cache off so it must be the cache that causes it.)

I checked it on the webite mentioned http://www.conscious-robots.com and it shows the same behaviour.

This is that if you click on a story and therewith open it in the main window. and then from there choose another language.
It, not allways, shows the same article but in many cases another (previous cached?) article....
I'm not sure what causes this nor do i know how to solve it, somebody any ideas?


Yup, that is my site. I know that problem, but I've been postponing the investigation of a fix as I've been busy with other stuff.. I thought that the problem is caused by the JoomSEF component.. Are you you using the same component for SEO?

I could try the same as you and use JAcceletator and see if the problem disappear. That would confirm that is nothing to do with SEF, and Joomla caching is the root cause.

Anyhow I think there's something wrong with my JoomSEF as I have aroung 20000 translated URLs in the database! And most of them seem to return 404...
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid

Re: Joom!Fish and cache enabled

Postby gaupe on Sun Jul 22, 2007 9:53 pm

I am using the sh404sef and it looked until now to be without any problem had the cache of jaccellerator in 1d1h (The default)
and was busy all day translating in two extra languages (dutch and norwegian from english)

later when we finished translating i was playing a litle with the setup and  (put jaccelerator  on 5d1 allso put the urlcache of the sh404sef on ) and suddenly i got all 404s too and all links where pointing to wron language parts of the content.....
cleaned out all the caches from both the sh404sef and jaccellerator and all was fine again....

Hmmm have to play with this a little longer i guess to see if this solution is worry free.....
but am curious at your findings.
User avatar
gaupe
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 16
Joined: Sat Jul 14, 2007 10:00 pm

Sv: Joom!Fish and cache enabled

Postby perandre on Fri Aug 03, 2007 7:15 pm

I'm having trouble with cache + joomfish + sh404SEF. No 404, but only default languge articles show up...
User avatar
perandre
Joomla! Engineer
Joomla! Engineer
 
Posts: 343
Joined: Thu Feb 23, 2006 2:17 am
Location: Norway

Re: Joom!Fish and cache enabled

Postby gaupe on Fri Aug 03, 2007 11:35 pm

ah well played with it for some days and didn't see any problems anymore.
the clearing of all the caches in accelerator and the sef and then no changes anymore in the settings of these two gave errorfree
driving.... as far as i can see.
User avatar
gaupe
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 16
Joined: Sat Jul 14, 2007 10:00 pm

Sv: Joom!Fish and cache enabled

Postby perandre on Sat Aug 04, 2007 7:05 am

Interesting, I will try a little harder...
User avatar
perandre
Joomla! Engineer
Joomla! Engineer
 
Posts: 343
Joined: Thu Feb 23, 2006 2:17 am
Location: Norway

Re: Joom!Fish and cache enabled

Postby array2001 on Mon Nov 05, 2007 4:33 pm

It seems that upgrading to Joom!Fish 1.8 fixed this problem for me  8)  So I keep on using JoomSEF, Joomla Cache and JF 1.8, and finally I can switch any content from one language to another without a problem.

You can have a look at http://www.conscious-robots.com. Please, let me know if you see any bad language switch with your browsers.. Thx!

Cheers,
Raul.
User avatar
array2001
Joomla! Apprentice
Joomla! Apprentice
 
Posts: 27
Joined: Mon Oct 30, 2006 10:48 am
Location: Madrid


Return to Joom!Fish and Multilingual Sites

Who is online

Users browsing this forum: No registered users and 1 guest