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

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

eZ debug

Timing: Jan 19 2025 00:12:00
Script start
Timing: Jan 19 2025 00:12:00
Module start 'layout'
Timing: Jan 19 2025 00:12:00
Module start 'content'
Timing: Jan 19 2025 00:12:01
Module end 'content'
Timing: Jan 19 2025 00:12:01
Script end

Main resources:

Total runtime1.3299 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 588.1563152.6563
Module start 'layout' 0.00600.0028 740.812539.5078
Module start 'content' 0.00871.3199 780.3203613.2813
Module end 'content' 1.32860.0013 1,393.601624.0938
Script end 1.3298  1,417.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2590160.0002
Check MTime0.00140.1067160.0001
Mysql Total
Database connection0.00080.057410.0008
Mysqli_queries1.242593.4299720.0173
Looping result0.00080.0605700.0000
Template Total1.292597.220.6462
Template load0.00210.158720.0011
Template processing1.290397.025320.6452
Template load and register function0.00010.008010.0001
states
state_id_array0.00080.062910.0008
state_identifier_array0.00200.152820.0010
Override
Cache load0.00190.1412500.0000
Sytem overhead
Fetch class attribute can translate value0.00070.050820.0003
Fetch class attribute name0.00220.1644100.0002
XML
Image XML parsing0.00100.077820.0005
class_abstraction
Instantiating content class attribute0.00000.0032160.0000
General
dbfile0.00210.1611230.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs