This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » General » Cache-block issues in Community...

Cache-block issues in Community Project 2012.8

Cache-block issues in Community Project 2012.8

Thursday 12 May 2016 6:13:52 pm - 9 replies

I have troubles with an old version of eZ publish 4 : Community Project 2012.8.

My Viewcache is correctly enabled, when I access a view full for the second time, only 1 mysql query is made.

But if I try to use cache-blocks in my view full like this :

 <span>{set-block scope=root variable=cache_ttl}0{/set-block}</span>
{cache-block keys=array($var1, $var2, $var3 )}

then, the number of queries increase at 16 and neither decrease even if I access many times the page...

Any ideas ? perhaps a bug in this community version ?

Thanks in advance for your help !

Wednesday 18 May 2016 8:40:33 am

After many tests, I confirm that with a blank pagelayout.tpl :

{* This comment will be replaced with actual debug report (if debug is on). *}

And this view full override :

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

The first time I access the node, 41 mysql queries are made (that's OK), but the second time I access it, and all the over, 17 queries are still made, even if the page is blank because I don't display anything into pagelayout.tpl or my_view_full.tpl...

Very strange :/

Modified on Wednesday 18 May 2016 8:41:35 am by Sébastien Antoniotti

Wednesday 18 May 2016 1:35:21 pm

the cache_ttl 0 has nothing to do with cache-block settings.

This settins is only used for content/viewcache   e.g. in the full view templates.   (the result in module_result.content).

cache-blocks can be only configured by cache-keys

Wednesday 18 May 2016 2:23:09 pm


OK, so how do you custom a view full template to have a part of them being refreshed every X seconds ?

If i put this into my homepage.tpl, the datetime is not refreshed every 10 seconds :

{cache-block expiry=10}
{currentdate()|datetime( 'custom', '%h:%i:%s' )}

Wednesday 18 May 2016 5:09:52 pm

1. you have to disable viewcaching in your node/view/full.tpl with {set-block scope=root variable=cache_ttl}0{/set-block}

2. than you can use cache-blocks  in  node/view/full.tpl if it makes sense

Wednesday 18 May 2016 5:29:51 pm


That's exactly what I did (see my first post).

And it still generates 17 mysql queries (I refreshed the page many times), even if my node/view/full.tpl just contains "{set-block scope=root variable=cache_ttl}0{/set-block}"

... and even with an empty pagelayout.tpl who just display {module_result.content}

Yet view caching is well activated : at the first loading, 41 queries are done, it decreases to 17 at second loading, but it is still too !

Modified on Wednesday 18 May 2016 5:30:49 pm by Sébastien Antoniotti

Thursday 19 May 2016 9:03:15 am

When you disable the viewcache in your view template you will have more sql queries because ez always fetch the $node for the view template it does not matter if you use a cache block in the view template or not.

If viewcache is active ez know that for the view and return an existing cached template (html) and than you have less sql queries.

Thursday 19 May 2016 9:17:35 am

OK, so can you confirm me that there is no way to have a part of a view full template controlled by a cache-block without generating this 17 mysql queries who will never be cached ?

Thursday 19 May 2016 1:54:12 pm

yes i can confirm - i did not test it but i think this is the case.

If you want a custom view with less sql queries you should write your own extension / module / view

than you has the most things under control and you can use cache-block in your view template, too.

Thursday 19 May 2016 2:01:54 pm

OK, thanks again for your help.


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

36 542 Users on board!

Forums menu

Proudly Developed with from