cache_ttl - am I going mad!

Author Message

David Syers

Friday 20 August 2004 10:42:53 am

Perhaps it is because it is the end of a long day, but I am getting frustrated with this whole cache_ttl thing.

Basically I am playing about with having some dynamic code, but I do not want to turn off view caching. Now if I put the following in my template:

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

and if I have a custom tag output the date and time and refresh the time changes as I would expect. However if I enter any value greater than 0 it is ignored! The default cache time appears to kick in.

Now am I being silly here and missing something really basic? Is there a minimum value for cache_ttl?

I am using version 3.4.1, SVN revision 7051. I am also running Apache 1.3.31, PHP 4.3.8 and ZendOptimizer.

Thank you for any help you can give me.

Björn Dieding@xrow.de

Sunday 22 August 2004 5:21:24 am

As far as I can remember

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

has no effect on content/view templates when view chaching is on.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

David Syers

Sunday 22 August 2004 8:22:09 am

Trust me it does (providing the view has not already been cached). With viewing caching on and setting cache_ttl to 0 disables the cache, but anything else has no effect and the normal caching takes over.

Looking at kernel/classes/eznodeviewfunctions.php at lines 125-140 you have:

// Check if time to live is set in template
        if ( $tpl->hasVariable( 'cache_ttl' ) )
        {
            $cacheTTL =& $tpl->variable( 'cache_ttl' );
        }

        if ( !isset( $cacheTTL ) )
        {
            $cacheTTL = -1;
        }

        // Check if cache time = 0 (disabled)
        if ( $cacheTTL == 0 )
        {
            $viewCacheEnabled = false;
        }

This is what is turning the cache off if it set to 0, but does nothing else with the cache if it is set to anything else. Is this correct? eZ crew - should the cacheTTL be used if set?

Paul Borgermans

Sunday 22 August 2004 8:30:56 am

Björn,

In theory (and to my experience) it is meant to be used when view-caching is on.

The behaviour with non-zero values seems to be a bug

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Björn Dieding@xrow.de

Monday 23 August 2004 3:00:55 am

Hi you two,

I was wrong.

I also can confirm this "bug", I checked the code and I wasn't able to find a place where the cache_ttl from a template is used to expire cache.

eZNodeviewfunctions::generateNodeView seems to be the only function that reads that value from the template.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Björn Dieding@xrow.de

Monday 23 August 2004 3:17:14 am

http://ez.no/community/bug_reports/there_seems_to_be_a_bug_with_the_cache_ttl_template_var

I just created a bug report about this.

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Wenyue Yu

Wednesday 08 September 2004 7:00:29 am

Hi,

The bug is fixed in svn 7924.

Regards,
wenyue

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 18 2025 16:27:03
Script start
Timing: Jan 18 2025 16:27:03
Module start 'layout'
Timing: Jan 18 2025 16:27:03
Module start 'content'
Timing: Jan 18 2025 16:27:03
Module end 'content'
Timing: Jan 18 2025 16:27:03
Script end

Main resources:

Total runtime0.8950 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 587.9141152.6250
Module start 'layout' 0.00810.0039 740.539139.4453
Module start 'content' 0.01200.8816 779.9844658.0391
Module end 'content' 0.89360.0014 1,438.023416.1641
Script end 0.8950  1,454.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4912160.0003
Check MTime0.00150.1667160.0001
Mysql Total
Database connection0.00110.119710.0011
Mysqli_queries0.825992.2748730.0113
Looping result0.00070.0763710.0000
Template Total0.857995.820.4289
Template load0.00250.274020.0012
Template processing0.855495.573320.4277
Template load and register function0.00020.020110.0002
states
state_id_array0.00140.151410.0014
state_identifier_array0.00110.124820.0006
Override
Cache load0.00210.2369410.0001
Sytem overhead
Fetch class attribute can translate value0.00040.049640.0001
Fetch class attribute name0.00120.129890.0001
XML
Image XML parsing0.00130.149440.0003
class_abstraction
Instantiating content class attribute0.00010.0093110.0000
General
dbfile0.00140.1521230.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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs