Share » Forums » Developer » set-block = no cache won't work

set-block = no cache won't work

set-block = no cache won't work

Friday 27 February 2009 8:12:22 am - 7 replies

Author Message

Ivo Lukac

Friday 27 February 2009 9:18:13 am

AFAIK {set-block ...} is not needed here.
If there is no cache-block and the template is not inside module_result.content view cache mechanism ) it should work.

Did you try with TemplateCompile enabled?

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Pablo Pernot

Friday 27 February 2009 9:28:41 am

I worked with templatecompiled enabled "before". Do you think the cache is still there because templates are still compiled ? I disabled it, but maybe some templates compiled are still active ? I did --clear-all few times since. Is there a way to check if it is using compiled templates or not ?

What should be the best strategy ? Still keeping my random image into the page layout ? Adding cache-block into the template ?

thanks

 

Pablo Pernot
http://www.smartview.fr
http://www.areyouagile.com

Steven E. Bailey

Friday 27 February 2009 1:45:36 pm

The Set block cache_ttl is for setting the view caching time not template caching. Do you have view caching enabled?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Pablo Pernot

Friday 27 February 2009 10:33:31 pm

Yes, I activated the viewcache. But nothing more, I mean I did not configured ant specific action or classes yet.

Pablo Pernot
http://www.smartview.fr
http://www.areyouagile.com

Steven E. Bailey

Saturday 28 February 2009 12:00:50 am

I tried this by turning ViewCaching, TemplateCaching and TemplateCompile on in a test 4.03 environment and replacing my pagelayout with just:

{include uri='design:random_background.tpl'}

and making random_background.tpl:

{def $rand=rand(1,3)}
<html>
<font size="+6">{$rand}</font>
</html>

Which created a var/<plain>/cache/template/compiled/random_background-<hash> file the first time I loaded. Where the $rand was loaded in that file, it was still a variable - not hard-coded.

The random number was never cached - whether the set-block was there or not.

So, I think if you can test like this, do it and see for yourself if it is caching or not.

Otherwise, are you sure you are testing what you think you are testing and are you sure you aren't being tricked by your local browser cache?

Or, I wrapped the stuff in random_background.tpl in a cache-block with a uri key - *THEN* it was cached - so are you absolutely sure that your include isn't in a cache-block?

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

Pablo Pernot

Wednesday 04 March 2009 5:13:13 am

Thanks a lot

Yes I found that in the compiled template, but obviously the compiled template isn't used because If I'm adding some stuff (var_dump, exit, few other funny things...) nothing happened. It is not my browser cache, nor any other proxy / cache ? any idea ?

// def $rand
unset( $var );
if (! isset( $var ) ) $var = NULL;
while ( is_object( $var ) and method_exists( $var, 'templateValue' ) )
$var = $var->templateValue();
$varData = array( 'value' => $var );
$tpl->processOperator( 'rand',
array (
0 =>
array (
0 =>
array (
0 => 2,
1 => 1,
2 => false,
),
),
1 =>
array (
0 =>
array (
0 => 2,
1 => 3,
2 => false,
),
),
),
$rootNamespace, $currentNamespace, $varData, false, false
);
$var = $varData['value'];
unset( $varData );
if (! isset( $var ) ) $var = NULL;
while ( is_object( $var ) and method_exists( $var, 'templateValue' ) )
$var = $var->templateValue();
if ( $tpl->hasVariable( 'rand', $rootNamespace ) )
{
$tpl->warning( 'def', "Variable 'rand' is already defined." );
....

Pablo Pernot
http://www.smartview.fr
http://www.areyouagile.com

Pablo Pernot

Wednesday 04 March 2009 7:01:12 am

Ok.

sorry all for the inconvenience...

I discovered a cache-block not closed... and things run fine now...

BTW I know now the complete tree of var/cache.

Pablo Pernot
http://www.smartview.fr
http://www.areyouagile.com

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

36 542 Users on board!

Forums menu