Share » Forums » Developer » {cache-block} implementation again

{cache-block} implementation again

{cache-block} implementation again

Thursday 05 June 2003 7:05:50 am - 2 replies

Author Message

Bård Farstad

Thursday 05 June 2003 7:16:35 am

What you need to do is to figure out what makes the current block unique. E.g. if you've caching a menue which is the same inside every section you need to make the cache block unique pr section. The uniqueness is decided by the keys of the cache block.

If you have something which is unique pr page ( e.g. the path code ) you could use the request url to make the cache block unique.

Cache blocks will automatically expire when content is published and you can set a timeout.

--bård

Documentation: http://ez.no/doc

Alexei Pechekhonov

Thursday 05 June 2003 9:25:44 am

Thank you, Bard. Now i'm feeling myself more confidence :)
Couldn't you, please, demonstrate your ideas on my example?
Every section on my site has a few lists: menu, line-view, midle-view etc ...
e.g.
loop=list1,
loop=list2,
loop=list3 <--- + some internal loop4
Right? In let/default area i define 3 of them, then i use {set}, but it depends on section, so i need, like you've suggested, to use path/url var ( say $DesignKeys:used.node)for uniquness then cache-block:
{let list1 list2 list3 }
{cache-block keys=array($list1, $list2, $list3, $DesignKeys:used.node}

{set list1=fetch(content,list,hash(parent_node_id, $DesignKeys:used.node ...)}
{set list2=fetch(content,list,hash(parent_node_id, $DesignKeys:used.node ....)}
{set list3=fetch(content,list,hash( parent_node_id, $DesignKeys:used.node ....)}

some_funny_code ...
{section loop=list1 show=....} show_zone1 {/section}
{section loop=list2 show=....} show_zone2 {/section}
{section loop=list3 show=....} show_zone3 ...internal_loop4... {/section}
. . . . . . . . . . . . . . . . . . . . . .
{/cache-block}
{/let}

Yes, the "structure" of lists is the same, but parent_node_id is various from section to section.
Please correct me or share, please, another suitable point of view.

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu