Welcome Guest, Not a member yet? Register   Sign In
Cache probleme, cache same page but page guest and page user
#1

[eluser]Kaosland[/eluser]
hello

I have a page that put in cache but this page show more information than the visitor is logged.
But when put page in cache, only le page for guest is show.
Somebody can tell me,avoid this probleme (don't said don't put in cache)
thanks
#2

[eluser]sophistry[/eluser]
the CI cache library is VERY simple-minded - it can not do what you want it to do.

please look at the wiki or search the forums for cache - there are several 3rd-party contributions that can do this.

cheers!
#3

[eluser]Rob Gordijn[/eluser]
Hi kaosland,

Correct me if I don't understand your problem wrong, but:

Code:
if($user_logged_in === FALSE)
{
    $this->output->cache(n);
}

a way to enable cache when a visitor is a guest, and thus not logged in?
#4

[eluser]Jelmer[/eluser]
@Rob

The Cache library caches the output generated for a certain URI. When CI loads it checks for cache for the URI requested before anything has been loaded or processed. If cache is found it will load the cache without loading the controller and without doing any checking for login or anything of the kind.

So by putting it behind a logged_in condition it will serve up fresh content while logged in users visit, but after the first non-logged in visit it will only serve up the cached content (not logged in) until it expires. Even for logged in users because the system loads the cache and never sees the condition anymore until the cache expires.
#5

[eluser]Rob Gordijn[/eluser]
@Jelmer, thanks for your explanation!
I didn't look into the output class yet, but now I have and understand how it works.
But still can't figure out a solution for the 'problem' of kaosland.
Maybe youcan do some dirty directing based on a logged_in condition and send both logged_in and not_logged_in users to a specific page...
#6

[eluser]Kaosland[/eluser]
Thanks fo your help

I use the lib developped by Jemler here or Here and I found the solution, i write Here
#7

[eluser]sophistry[/eluser]
glad you solved it. MP_cache looks really good - especially dependency checking.

this forum thread has some nice code that lets you cache single function or method calls:

http://ellislab.com/forums/viewthread/127155/

i like it because it keep the code changes minimal.




Theme © iAndrew 2016 - Forum software by © MyBB