Page 1 of 1

Force Cache Pages for Logged In Users?

Posted: Mon Sep 09, 2013 1:40 pm
by redluss
Hello All-

I'm working on a website that's a bit different than most - 100% of my users are registered. I need to somehow make the page cache work so that it will cache pages for registered users, which I know is not the normal behavior for Joomla!.

There doesn't appear to be much discussion on this throughout the web. I know what the concerns are with caching pages for registered users, but in this instance, it doesn't matter as they will all see the same content once they're logged in.

Does anyone know if I can hack the cache.php file at /plugins/system/cache/cache.php to force it to just cache everything? On line 62, I see

Code: Select all

if ($user->get('guest') && $_SERVER['REQUEST_METHOD'] == 'GET') {
			$this->_cache->setCaching(true);
and I'm guessing that's what's controlling the behavior. Can I either remove this, or implement a second true statement that specifies registered users? Alternatively, can I just remove the "if" and change the statement to:

Code: Select all

$this->_cache->setCaching(true);
Thanks for any insight or help anyone can provide.

Re: Force Cache Pages for Logged In Users?

Posted: Thu Mar 05, 2015 8:04 pm
by jptkts
I have a similar situation. My users all have to log in, and without cache on pages are loading slow. Did this code work for you? The downside here is that it will need to be added again if you update joomla (as its a core change). However, its hard to believe that more people don't have an issue with this and want module cache for signed in users.

Re: Force Cache Pages for Logged In Users?

Posted: Thu Mar 05, 2015 8:37 pm
by jptkts
Oh, I just realized you changed the code of the system plugin. I just wanted to cache individual modules for signed in users with progressive caching. I doubt you would want to use the system cache plugin for signed in users, as the system cache plugin will cache the entire page (not individual modules). Each user will see a different page so this would never work.

In theory though, progressive module caching caches a version of a module for each unique visitor. However, any cache is disabled when signed in; but if it could be turned on somewhere with a core modification it may work. I'll test it out someday

Re: Force Cache Pages for Logged In Users?

Posted: Tue Apr 10, 2018 10:04 am
by laxmiram19
Hi redluss,

I have the same situation now. I need to do a force caching for the Logged In Users based on few conditions.

I have tried by setting "$this->_cache->setCaching(true);" but it is not working.

Can you please share what are the changes required to do to the "Force caching for the Logged In Users".

Thanks in advance