Full page caching cause some weird situations
Permalink 4 users found helpful
Hi
I do have a site which has a decent amount of custom coding. i.e. in header.php it has some custom code to show whether a user is logged in or not. If not, it shows welcome guest & some normal cms links. but if a user is logged in, it shows user info, logout link, some important page links, create blog links and many more.
Everything seems to be working fine if I disabled the full page caching. But if it is enabled then the problem occurs.
Here is the scenario: Suppose I'm logged in and navigate to another page, the header shows the non logged in links. But the session doesn't expires as if I refresh the page, it shows the logged in info. Same thing happened for other pages.
Note: I'm 100% sure about the coding, its absolutely okay. no bug is there.
is there a way to solve this. If I disable the cache, the loading time will increase which I won't let it happen.
Please help me.
Rony
I do have a site which has a decent amount of custom coding. i.e. in header.php it has some custom code to show whether a user is logged in or not. If not, it shows welcome guest & some normal cms links. but if a user is logged in, it shows user info, logout link, some important page links, create blog links and many more.
Everything seems to be working fine if I disabled the full page caching. But if it is enabled then the problem occurs.
Here is the scenario: Suppose I'm logged in and navigate to another page, the header shows the non logged in links. But the session doesn't expires as if I refresh the page, it shows the logged in info. Same thing happened for other pages.
Note: I'm 100% sure about the coding, its absolutely okay. no bug is there.
is there a way to solve this. If I disable the cache, the loading time will increase which I won't let it happen.
Please help me.
Rony
The only way I know to have the full page cache and get round such issues is to insert the info using JavaScript, possibly with ajax callbacks. However, unless you are very careful doing that could open up security holes. Also, it could become a big new overhead that kind of defeats the intention of using the full page cache.
Thanks for your reply. It looks like it will be a headache for me as the site is ready. Now if I'm going to make it through javascript or Ajax callback, it can create another problem. Is there a way to make the site fast without full page caching. Like can I make the main wrapper div to be cached?
Rony
Rony
Just set caching on a per-block basis.
Similar stuff, such as pagination and other dynamic elements, are known not to work with full caching enabled. It's not a bug, just a behavior thing.
Enable full caching wherever the blocks on the page allow it, not in all cases.
Similar stuff, such as pagination and other dynamic elements, are known not to work with full caching enabled. It's not a bug, just a behavior thing.
Enable full caching wherever the blocks on the page allow it, not in all cases.
great. But whats about the static php code that I've written down in header?
Rony
Rony
With full page caching, your header only gets executed when the cache is filled.
It caches your header so I guess this answers your question.
Try to create a block from it.
PS: kinda funny to use the term "static PHP code" :)
Try to create a block from it.
PS: kinda funny to use the term "static PHP code" :)
Thanks MoonGrab. I'll try to create a block.
And sorry for the typo, its more likely Hard coded rather static, :)
Rony
And sorry for the typo, its more likely Hard coded rather static, :)
Rony
http://www.concrete5.org/developers/pro-accounts/community-leaders-...
This thread also touches on the full page cache, but is more concerned with the block cache
http://www.concrete5.org/community/forums/documentation_efforts/spe...