Forums / Setup & design / Cache-block subtree expiration - how deep does it check?

Cache-block subtree expiration - how deep does it check?

Author Message

Piotrek Karaś

Monday 09 April 2007 5:38:33 am

Hi,

I have now spent over a week trying to figure out subtree_expiry parameter of cache-block function. Unfortunately, no effects...I've gone through every piece of information of this forum and documentation that seemed to be relevant, tried every combination that seemed logical... Basically - it does not work and took me to draw one conclusion - subtree_expiry only works, when a child node directly one level below the block is expired, two or more do not matter... But then what would be the purpose of it?

The task seems simple. I have the following structure:

+ vehicles
++ cars
+++ bmw
+++ peugeot
++ motorcycles
+++ honda

When in 'vehicles' node, I fetch all the sub-nodes to output a list of vehicle groups (lev2) and their brands (lev3). How do I force the cache to be expired in case something on level3 changes?

Thanks for any suggestions.

--
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

Kristof Coomans

Monday 09 April 2007 11:03:30 pm

Hi Piotr

Can you show us the cache-block you used? Thanks.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotrek Karaś

Monday 09 April 2007 11:50:36 pm

Hello Kristof,

I can show you what my best guesses were, but it would be difficult to remember all the combinations I have gone through, it took hours... :) Here we go:

design:full/my_vehicles_class.tpl (level1)

{* a *}{cache-block keys=$node.node_id subtree_expiry=$node.path_identification_string}
{* b *}{cache-block subtree_expiry=$node.path_identification_string}

{* fetch('content','list/tree', ...) *}
{* display level2 and level3 elements *}

{/cache-block}

I tried two scenarios as well, with level2 and level3 elemenents being published via administration interface and self-prepared 'add group/add brand' content action forms.

--
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

Kristof Coomans

Tuesday 10 April 2007 3:38:13 am

Give this a try:

subtree_expiry=$node.url_alias|remove(0,1)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotrek Karaś

Tuesday 10 April 2007 4:44:54 am

Nothing changes, except for the fact that there's a debug error:

Error: eZTemplateCacheFunction::subtreeExpiryCacheDir()
Could not find path_string for 'subtree_expiry' node.

What exactly would be the purpose of it? Should I expect any special characters in the url_alias attribute that may affect the function? In that case, wouldn't it be better to trim its value instead? Otherwise, what would be the point? Just curious :)

--
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

Kristof Coomans

Tuesday 10 April 2007 5:57:12 am

Hi Piotr

Apparently I encountered certain issues with cache-block before, and the code above made it work in those cases. I inspected the PHP code now and what I did was indeed not needed since slashes are trimmed in the PHP template function code to.

Do you have DelayedCacheBlockCleanup=enabled in one of your site.ini overrides? If yes then remove it or use the subtreeexpirycleanup cronjob. Have you enabled view caching? Then you need to disable it for your specific template. Put this at the first line of the template:

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

.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotrek Karaś

Tuesday 10 April 2007 6:39:05 am

That's right, now I remember some former posts concerned with subree_expiry syntax and the slashes. I think I have even tried concatenating the path and the slash... but it didn't work either as far as I remember... :)

I'll let know as soon as I check your latest suggestions. Thanks.

--
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

Piotrek Karaś

Wednesday 11 April 2007 2:53:23 pm

Yes! That's it.
I added:

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

then:

{cache-block subtree_expiry=$node.path_identification_string}

and it begun to work as expected! It's just 10 minutes of experimenting, but it seems like good direction.

Thanks for your help, Kristof!

--
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 20:54:50
Script start
Timing: Jan 18 2025 20:54:50
Module start 'content'
Timing: Jan 18 2025 20:54:51
Module end 'content'
Timing: Jan 18 2025 20:54:51
Script end

Main resources:

Total runtime1.0734 sec
Peak memory usage4,096.0000 KB
Database Queries209

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.9531180.8125
Module start 'content' 0.00600.8969 768.7656618.3906
Module end 'content' 0.90290.1705 1,387.1563345.0234
Script end 1.0734  1,732.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3896210.0002
Check MTime0.00160.1513210.0001
Mysql Total
Database connection0.00100.089510.0010
Mysqli_queries0.970890.44182090.0046
Looping result0.00250.23282070.0000
Template Total1.048797.720.5243
Template load0.00230.214120.0011
Template processing1.046497.476020.5232
Template load and register function0.00010.009910.0001
states
state_id_array0.00080.071410.0008
state_identifier_array0.00080.076220.0004
Override
Cache load0.00210.1921500.0000
Sytem overhead
Fetch class attribute can translate value0.00120.113130.0004
Fetch class attribute name0.00130.1256100.0001
XML
Image XML parsing0.00120.116430.0004
class_abstraction
Instantiating content class attribute0.00000.0040160.0000
General
dbfile0.00870.8098340.0003
String conversion0.00000.000530.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
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs