Author Topic

Atle Pedersen

Friday 10 July 2009 6:05:52 am

Comment51471

Thank you, I forgot that cache-block can be used in all templates.

I ended up with something like this:

{cache-block keys=array($node.node_id,'loop1') subtree_expiry=$node.url}
  {def $nodelist=fetch(...)}
  {foreach $nodelist as $n}
    {cache-block keys=array($n.node_id,'loop1') subtree_expiry=$n.url}
      {node_view_gui content_node=$n}
    {/cache-block}
  {/foreach}
{/cache-block}

I have only tested it superficially, but it seems to work and give good speed increase compared to uncached version. I do need a {set-block scope=global variable=cache_ttl}0{/set-block} on top though. Probably because I need the list to be updated when children of children are being changed.

One short question, is using $node.url a good way to set subtree_expiry?