{node_view_gui...} and View Caching

Author Message

Nabil Alimi

Wednesday 01 November 2006 2:01:49 am

Hi,

How does view caching actually works ?

By using the node_view_gui operator with a custom view, is it used by default ?

Or should it be enabled in some way ?

Thanks !

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Kristian Hole

Wednesday 01 November 2006 9:26:14 am

A new chapter in the documentation which describes the viewcaching is actually available today!

http://ez.no/doc/ez_publish/technical_manual/3_8/features/view_caching

Enjoy :-)

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Nabil Alimi

Thursday 02 November 2006 5:43:37 am

Thanks Kristian,

Well looks like that there is no view caching while using {node_view_gui}.

Wouldn't it be a nice feature ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Kristian Hole

Thursday 02 November 2006 9:08:52 am

I don't know exactly how you would like that to work. Currently it works like this:

If you use {node_view_gui} in some of the node/view/*.tpl and overrides loaded by the content/view module, the {node_view_gui} will be cached by the view-caching. This is because the whole view is cached.

If you are using {node_view_gui} in the pagelayout or included templates, you should add a cacheblock around the code that is fetching/generation information from the database. I typically use cache-blocks for menus and similar elements in the pagelayout.

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/cache_block

Was this understandable?

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Nabil Alimi

Thursday 02 November 2006 9:33:21 am

Yes that's how i'm actually processing.

But like this - provided you want to fine-tune the way you use cache-blocks with subtree_expiry - there's no equivalent to the smart view-cache clear feature that clears dependent nodes' view-cache and so on... (Dependent nodes = object-related ones for example).

This leads to less accurate cache-block handling...

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Kristian Hole

Thursday 02 November 2006 10:32:20 am

Yes, you are right. The all of the cache-blocks are automatically invalidated upon content-publish. You can however restrict it with the subtree_expiry and the ignore_content_expiry parameters. But it is as you say, less flexible than the smart-view-cache-system.

Do you have any good ideas on how to implement something similar for the cache-blocks?

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Nabil Alimi

Thursday 02 November 2006 11:45:58 am

Well, the only work-around I found fo far is to add the $node.object.modified time of the related object to the keys of the cache-block.
Like this, once the related object is modified, the cache-block expires and a new one is built. It works fine so far for most cases.
But if the related-object as itself related-objects, and that the node_view_gui displays or has any relation with those re-related-objects (wow), it might not work as we expect.

The topic remains open. :-)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Xavier Dutoit

Friday 03 November 2006 7:56:30 am

Salut Nabil,

Could you share with us the code you use ?

Not sure I understand how to use the date modified as a key.

X+

http://www.sydesy.com

Kristian Hole

Friday 03 November 2006 10:09:07 am

@Xavier:

Nabil means that he is doing something like this:

{cache-block keys=array( .... , $node.object.modified)}

@Nabil:

I see your point. It would be useful if the cache-blocks supported this somehow. Currently I do not have any good ideas for how this can be implemented. Anybody have any good ideas?

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Nabil Alimi

Tuesday 07 November 2006 1:31:48 am

Hi Xavier,

Kristian is right, that's how i'm proceeding.

Something nice would be to have a new dependent_nodes param to the cache-block operator which will work with an hash to support depth.

{cache-block ... dependent_nodes=hash( '234' , 2 , '350' , 4 )}

So if any node 2 levels below or upper node 234 is modified, the cache-block will expire.

Maybe it isn't a good idea at all though. :-)

And, I don't know if this can be easily made or not. :-)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Kristian Hole

Tuesday 07 November 2006 4:04:47 pm

Nabil:

So basically, what you want to be able to do is some thing like this:

{cache-block subtree_expiry=array('products/','company/about/','/forum)}
...
{/cache-block}

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

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 31 2025 00:41:16
Script start
Timing: Jan 31 2025 00:41:16
Module start 'layout'
Timing: Jan 31 2025 00:41:16
Module start 'content'
Timing: Jan 31 2025 00:41:16
Module end 'content'
Timing: Jan 31 2025 00:41:16
Script end

Main resources:

Total runtime0.0304 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0041 588.1328151.2109
Module start 'layout' 0.00410.0033 739.3438220.7031
Module start 'content' 0.00740.0213 960.04691,017.9297
Module end 'content' 0.02880.0016 1,977.976649.9922
Script end 0.0304  2,027.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00268.6589140.0002
Check MTime0.00113.6486140.0001
Mysql Total
Database connection0.00061.959910.0006
Mysqli_queries0.00196.116530.0006
Looping result0.00000.036110.0000
Template Total0.00113.510.0011
Template load0.00082.703110.0008
Template processing0.00020.759710.0002
Override
Cache load0.00061.847810.0006
General
dbfile0.005417.640080.0007
String conversion0.00000.016540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs