Forums / Setup & design / {node_view_gui...} and View Caching

{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

eZ debug

Timing: Jan 18 2025 11:21:47
Script start
Timing: Jan 18 2025 11:21:47
Module start 'content'
Timing: Jan 18 2025 11:21:47
Module end 'content'
Timing: Jan 18 2025 11:21:47
Script end

Main resources:

Total runtime0.1744 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 587.7266180.8359
Module start 'content' 0.00820.0067 768.5625114.0078
Module end 'content' 0.01490.1594 882.5703541.9531
Script end 0.1743  1,424.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00372.1493200.0002
Check MTime0.00150.8535200.0001
Mysql Total
Database connection0.00201.164610.0020
Mysqli_queries0.118067.67701410.0008
Looping result0.00130.73971390.0000
Template Total0.159191.210.1591
Template load0.00080.477710.0008
Template processing0.158290.720810.1582
Override
Cache load0.00060.344610.0006
Sytem overhead
Fetch class attribute can translate value0.00090.521810.0009
XML
Image XML parsing0.00030.182410.0003
General
dbfile0.00653.7163200.0003
String conversion0.00000.003630.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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