ViewCaching

Author Message

Andrew Kelly

Monday 12 December 2005 6:57:12 am

Hi all,
I'm having a bit of a problem getting my brain around ViewCaching, wonder if anybody can help me out.

If I turn off my view caching, my server load starts climbing into ugly ranges and performace degrades rapidly. So obviously, we want to have ViewCaching enabled. The problem is that in my pagelayout.tpl, I have some code at the bottom the left column which displays the content editor and time of last modification for the content being shown in the "main view", and when I have ViewCaching enabled this code gets broken. The editor is blank, and the last modified falls back to 01/01/1970.

How do I keep ViewCaching enabled to keep my performance up, but still have the Editor/Modified code remain functional?

Help?

Andy

Mark Marsiglio

Monday 12 December 2005 7:14:13 am

Andrew,

The variables in pagelayout with viewcaching enabled are a little different than other view modes/templates.

Take a look at http://ez.no/doc/ez_publish/technical_manual/3_6/templates/the_pagelayout/variables_in_pagelayout

This has some details. I think if you use a variable based on $DesignKeys or $module_result, you should be OK.

Also, make sure that those lines of code are excluded from any cache blocks.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Andrew Kelly

Tuesday 13 December 2005 1:13:31 am

Thanks, Mark,

tip much appreciated.

Andy

Andrew Kelly

Thursday 15 December 2005 1:29:47 am

Right,
problem 1 solved, problem 2 appears.

ViewCaching is kicking the stuffing out of my left-hand navigation. I have primary and secondary
navigation in a banner, and levels 3-6 in a left-hand menu. Functionally, the menu is fine and does everything it's supposed to but for 1 small detail. The active menu item is designed to have a section-specific background color, and with ViewCaching turned on these highlighted elements slowly start disappearing until the feature no longer appears at all.

Is there any way at all to hide things from the caching mechanism? Can I say "View Caching yes, but not right here"?

Andy

Paul Forsyth

Thursday 15 December 2005 3:34:58 am

You could try turning off view caching in that template and then use cache blocks. That might work.

So put:

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

at the top.

But use {cache-block} to wrap everything else apart from your dynamic bit.

Another method which isnt as useful but might work for you is to put a timeout in the cache-block:

{set-block scope=global variable=cache_ttl}60{/set-block}

Which will expire every minute. Not sure if this helps though.

Paul

Andrew Kelly

Thursday 15 December 2005 4:14:01 am

Paul,

> Thursday 15 December 2005 12:34:58 pm
> You could try turning off view caching in that template and then use cache blocks. That might work.

Yes, that's exactly the lever I'm looking for. In my current (very limited) understanding of eZp, ViewCaching is a global setting which is either enabled or disabled in site.ini(.append.php)
If there is a way to exclude blocks of code from this caching it's still beyond my ken.

Is this how it's done?

> So put:
> {set-block scope=global variable=cache_ttl}0{/set-block}
> at the top.
>
> But use {cache-block} to wrap everything else apart from your dynamic bit.

I don't think I'm following, could you please repeat that in another example?

The stuff I'd like to exclude from ViewCaching is in a template of its own, included in
pagelayout.tpl.
{include uri="design:leftnavi.tpl"}

Thanks a ton,

Andy

Paul Forsyth

Thursday 15 December 2005 4:22:28 am

Yip thats right, so in your template leftnavi.tpl put:

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

at the very top as the first line. this will disable caching for that template while retaining view caching everywhere else.

Some more info:

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_functions/miscellaneous/cache_block
http://ez.no/community/forum/developer/view_cache_trouble/

Paul

Andrew Kelly

Thursday 15 December 2005 4:40:07 am

Outstanding!
Thank you very much, Paul.

Andy

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 04:42:23
Script start
Timing: Jan 19 2025 04:42:23
Module start 'layout'
Timing: Jan 19 2025 04:42:23
Module start 'content'
Timing: Jan 19 2025 04:42:24
Module end 'content'
Timing: Jan 19 2025 04:42:24
Script end

Main resources:

Total runtime0.9382 sec
Peak memory usage4,096.0000 KB
Database Queries74

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 590.1406152.6094
Module start 'layout' 0.00770.0039 742.750039.3984
Module start 'content' 0.01160.9251 782.1484642.0625
Module end 'content' 0.93670.0014 1,424.210920.2031
Script end 0.9382  1,444.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3549160.0002
Check MTime0.00130.1369160.0001
Mysql Total
Database connection0.00120.127710.0012
Mysqli_queries0.847290.3012740.0114
Looping result0.00080.0843720.0000
Template Total0.893595.220.4467
Template load0.00220.231520.0011
Template processing0.891395.001720.4456
Template load and register function0.00010.013110.0001
states
state_id_array0.00140.152010.0014
state_identifier_array0.00100.106620.0005
Override
Cache load0.00200.2149720.0000
Sytem overhead
Fetch class attribute can translate value0.00070.072430.0002
Fetch class attribute name0.00120.1326100.0001
XML
Image XML parsing0.00110.115130.0004
class_abstraction
Instantiating content class attribute0.00000.0047140.0000
General
dbfile0.00140.1440210.0001
String conversion0.00000.001140.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
6content/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
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs