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.