User parameters cause cache trouble [solved]

User parameters cause cache trouble [solved]

Wednesday 31 October 2007 10:07:09 am - 4 replies

Modified on Monday 05 November 2007 6:11:56 am by Tobias Vogel

Author Message

Tobias Vogel

Friday 02 November 2007 3:14:27 am

If I set

TemplateCache=disabled

the problem is gone. Anyway that doesn't seem to be the right solution to me.

I tried custom cache-blocks in the include template:

{set-block scope=global variable=cache_ttl}0{/set-block}
{cache-block keys=array($node,$view_parameters)}
...
[template code]
...
{/cache-block}

These settings don't have any effect wherever I place them, even in the pagelyout.

Sebastiaan van der Vliet

Friday 02 November 2007 9:30:18 am

Hi Tobias, did you also try putting {cache-block expiry=0}include file{/cache-block}?

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

André R.

Friday 02 November 2007 10:14:05 am

{set-block scope=global variable=cache_ttl}0{/set-block}

Is for view cache ( aka content view cache, as in cache for the content/view module view), so has no effect on cache blocks.

As for setting expiry=0, this is what happens(from the doc):

A value of zero will produce a cache block that will never expire.

the reason it doesn't work is that the keys parameter only supports 1 level deep arrays.
It will not understand the $node or $view_parameters objects!

You can use $module_result.uri ( url + view params + view param values) if this is in a pagelayout:

{cache-block keys=$module_result.uri}
...
[template code]
...
{/cache-block}

You need to know what params are going to be used if this is in a node template:

{def $user_id = first_set($view_parameters.id, '')}
{cache-block keys=array($node.node_id, $user_id, $view_parameters.offset)}
...
[template code]
...
{/cache-block}

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Tobias Vogel

Monday 05 November 2007 6:11:42 am

Wow, thanks for your explanation, helped me a lot further and I also found the reason for some strange behaviour:

Somewhere in the middle of the pagelayout there was another cache-definition:

{cache-block keys=array($uri_string, $basket_is_empty, $user_hash)}

IMHO I read somewhere, that ezpublish can't keep track of children in a nested cache-block structure, so this artifact cache-block additionally interfered with my tests.

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

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