Cache-block leading to Ez cache consistently serving dirty pages?

Author Message

Tore Skobba

Wednesday 29 October 2003 8:35:35 am

Hi

I am developing an site where users should be allowed to log in and out. However, it seems that an cache-block function is destroying everything. This cache-block function seems to be documented in 3 lines, as such it is difficult to understand it. My main question is what does excatly an cache key do?

In my design I have an template which display the menu and a user panel (if anonymous user then a login and a register link, else logout and a edit(username) link). However, if I log in and out the user panel is not updated! I.e. an anonymous user has an link to edit(administrator user), the link is not working, but it should not be showing either. I thought this cache-block should make the cache work:

{cache-block keys=array($current_user.contentobject.id,'left_menu',$uri_string)}
{include uri="design:left_menu.tpl"}
{/cache-block}

I am trying to state that each $current_user must have their own content cached .

Hope someone have some tips on this

Tore

Vivienne van Velzen

Thursday 30 October 2003 1:15:28 am

Hi Tore,

Do you use a fetch to get the current_user? I.e. "current_user=fetch('user','current_user')".
I'm using this method as well to show different blocks for anonymous users and users who are logged in, and otherwise I can't see anything wrong with your code.
Greetings,

Vivienne

Tore Skobba

Thursday 30 October 2003 2:26:32 am

Hi

I do not use fetch to get the current user, this as I do not belive you need it, i.e. only {$current_user.contentobject.id} displays the id of the user. However, my stuff seems to work fine now, the reason might have been that I was editing the wrong cache block:

{cache-block keys=array('page_menu',$uri_string,$current_user.contentobject.id) }
{include uri="design:page_menu.tpl"}
{/cache-block}

Where page_menu.tpl is a template which first display menu links and sub menus. Then it imports another template which displays user info (login or log out etc.). This now seems to work very fine:)

But some docs on cache-block function would have been very nice.
Cheers
Tore

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.