Forums / Developer / {cache-block subtree_expiry =/PARENT} does not work.

{cache-block subtree_expiry =/PARENT} does not work.

Author Message

Jacks JNK

Monday 17 November 2008 2:48:51 am

Indeed, I want to change each node of a parent's "articles" that the cache is emptied

{cache-block  subtree_expiry='/PARENT'}

{def  $articles=fetch( content, list,hash(parent_node_id,239,limit,5,
									 									 class_filter_type,'include',
									 									 class_filter_array,array('article'),
									 			 						 'sort_by',array('published',true())) )}

	{foreach $articles as $article}
					
				<div class="menu1">
					
			<a href={$article.url_alias|ezurl}>{$article.name}</a>
				</div>
									
	{/foreach}	
	{undef $articles}	
{/cache-block }

Skype : jacks_ngala

André R.

Monday 17 November 2008 7:15:07 am

Use the node id instead, less prone for errors.
{cache-block subtree_expiry=239}

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

Jacks JNK

Tuesday 18 November 2008 12:40:51 am

it does not work !

Skype : jacks_ngala

Piotrek Karaś

Tuesday 18 November 2008 8:23:39 pm

I've never seen/heard of this /PARENT option. Has it ever worked?
If so, how does it work for non-node templates?

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Jacks JNK

Thursday 20 November 2008 2:06:06 am


no, it's just an illustration

Skype : jacks_ngala

André R.

Thursday 20 November 2008 5:53:19 am

what version are you on?
There is a bug in 4.0(and 3.10) that was fixed in 4.0.1 in regards to this.

@Piotrek: Do you remember witch issue? I remember you and kc identified it and made some test cases.

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

Jacks JNK

Thursday 20 November 2008 6:14:58 am


I have version 4.0.1 I think this bug persists until now !!!!

Skype : jacks_ngala

Piotrek Karaś

Thursday 20 November 2008 6:29:44 am

So far we haven't seen any weird behavior from cache-blocks in 4.0.1 (or since 4.0.0 patch).

Meanwhile, I only joined this thread because I thought there was a cache-block feature that I hadn't known about. But that's not the case. So before we rush into solving the problem, could we please have problem explained once again? Because I sincerely have no idea what Jacks' problem is and what he/she is trying to accomplish. Especially, I don't understand that parent reference...

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Jacks JNK

Thursday 20 November 2008 6:42:24 am

The parent is just the name of the attribute (node) containing my articles on what I am used cache. example:
You have an object "ARTICLES" and children "Article 1, Article 2 ,...) published in" ARTICLES ". So it has nothing with the internal workings of eZ

Skype : jacks_ngala

Piotrek Karaś

Thursday 20 November 2008 6:48:44 am

Well, that part is clear. Now what are you trying to achieve and how is cache related?

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Jacks JNK

Thursday 20 November 2008 6:56:53 am

I want enabled the cache-block which will expire when an object is published or modified in the parent node.

Skype : jacks_ngala

Piotrek Karaś

Thursday 20 November 2008 7:14:43 am

Still, to few details. For example - if you're trying to put those cache-blocks inside node templates - have you disabled viewcache?

Anyways, here you'll find my tests: http://issues.ez.no/12175

And here's a newer version:

{def $subtree_expiry_node_id=61}
{def $expiry_seconds=60}
<table>
<tr><th colspan="2">Current time: {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )}, Expiry={$expiry_seconds}, Subree expiry={$subtree_expiry_node_id}</th></tr>
<tr><th>STANDARD</th><th>WITH KEYS</th></tr>
<tr><td>
    {cache-block expiry=0}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}cache-block expiry=0{rdelim}
    {/cache-block}
    </td><td>
    {cache-block expiry=0 keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}cache-block expiry=0 keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr><tr><td>
    {cache-block ignore_content_expiry expiry=0}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}ignore_content_expiry expiry=0{rdelim}
    {/cache-block}
    </td><td>
    {cache-block ignore_content_expiry expiry=0 keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}ignore_content_expiry expiry=0 keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr><tr><td>
    {cache-block expiry=$expiry_seconds}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}expiry={$expiry_seconds}{rdelim}
    {/cache-block}
    </td><td>
    {cache-block expiry=$expiry_seconds keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}expiry={$expiry_seconds} keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr><tr><td>
    {cache-block ignore_content_expiry expiry=$expiry_seconds}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}ignore_content_expiry expiry={$expiry_seconds}{rdelim}
    {/cache-block}
    </td><td>
    {cache-block ignore_content_expiry expiry=$expiry_seconds keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}ignore_content_expiry expiry={$expiry_seconds} keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr><tr><td>
    {cache-block subtree_expiry=$subtree_expiry_node_id}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}subtree_expiry={$subtree_expiry_node_id}{rdelim}
    {/cache-block}
    </td><td>
    {cache-block subtree_expiry=$subtree_expiry_node_id keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}subtree_expiry={$subtree_expiry_node_id} keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr><tr><td>
    {cache-block subtree_expiry=$subtree_expiry_node_id expiry=$expiry_seconds}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}subtree_expiry={$subtree_expiry_node_id} expiry={$expiry_seconds}{rdelim}
    {/cache-block}
    </td><td>
    {cache-block subtree_expiry=$subtree_expiry_node_id expiry=$expiry_seconds keys=array( $uri_string )}
    {currentdate()|datetime( 'custom', '%Y-%m-%d %H:%i:%s' )} {ldelim}subtree_expiry={$subtree_expiry_node_id} expiry={$expiry_seconds} keys=array( $uri_string ){rdelim}
    {/cache-block}
</td></tr></table>

As far as I can see - things work fine.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

eZ debug

Timing: Jan 18 2025 11:30:06
Script start
Timing: Jan 18 2025 11:30:06
Module start 'content'
Timing: Jan 18 2025 11:30:07
Module end 'content'
Timing: Jan 18 2025 11:30:07
Script end

Main resources:

Total runtime1.3817 sec
Peak memory usage4,096.0000 KB
Database Queries223

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0102 588.9609180.8125
Module start 'content' 0.01021.2346 769.7734711.5078
Module end 'content' 1.24480.1367 1,481.2813352.4297
Script end 1.3815  1,833.7109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.3323210.0002
Check MTime0.00170.1224210.0001
Mysql Total
Database connection0.00120.085410.0012
Mysqli_queries1.262991.40082230.0057
Looping result0.00250.17762210.0000
Template Total1.343397.220.6716
Template load0.00230.167320.0012
Template processing1.341097.047920.6705
Template load and register function0.00010.007310.0001
states
state_id_array0.00200.148110.0020
state_identifier_array0.00100.072220.0005
Override
Cache load0.00210.1532510.0000
Sytem overhead
Fetch class attribute can translate value0.00160.115540.0004
Fetch class attribute name0.00120.0879150.0001
XML
Image XML parsing0.00170.120140.0004
class_abstraction
Instantiating content class attribute0.00010.0043240.0000
General
dbfile0.00430.3136410.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
12content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
12content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs