Welcome Guest, Not a member yet? Register   Sign In
Caching - Disable for 'logged in' users?
#1

[eluser]joshbuckley[/eluser]
Hi, I'm trying to do the following:

I have a dynamic page cached, but when there is a user logged in, they see more info (e.g. their details) that shouldn't be cached. To work around this, I used a method is_logged_in in my user model. Now, the cache doesn't get written with a particular users details.

However, the problem I have now is that if you login, because the page has been cached without your details, you dont see them.

I've tried creating MY_Output to override _display_cache, but at that point I can't do $CI =& get_instance() because it doesn't exist yet, and attempting to load the session class to work-around (checking for the existance of 'user_id' session data), I get an error where Session.php tries to use get_instance.

Is there an easy way to work around this?

Thanks,
Josh
#2

[eluser]joshbuckley[/eluser]
*Bump*

Anyone got any ideas?

Thanks
#3

[eluser]WanWizard[/eluser]
The default cache mechanism of CI is URI based, and caches the entire page.

The check on the existence of a cached page happens very early in the startup process, before you have access to (all) CI resources.

So basically it's a cache or no-cache situation. If you want more detailed cache control, you have to look for a more granular caching implementation, there are a few available.




Theme © iAndrew 2016 - Forum software by © MyBB