How to switch off clear cache interval

Author Message

Michael Zeidler

Friday 10 September 2004 7:17:54 am

Hallo,

I want to switch off the interval in which the clear cache mechanism is initiated. The interval is set to two hours by default. Why should the cache be cleared, while nothing was published within this two hours? Where this interval can be altered or switched off?

thanks

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Michael Zeidler

Friday 10 September 2004 11:05:12 am

of coarse a clear cache must be triggered when a cron script alters the content, so when for instance a rss feed is processed a publish process occurs, which clears the cache automatically.
Furthermore there is no need for clearing the cache by the mentioned interval.
I hope I am right with that assumption.

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Paul Forsyth

Friday 10 September 2004 1:12:31 pm

Have a read of this page:

http://ez.no/ez_publish/documentation/development/kernel/cache_block_optimization

paul

Michael Zeidler

Friday 10 September 2004 4:58:00 pm

Thanks Paul, for your reply. This is also an interessting link concerning to this topic

http://ez.no/ez_publish/documentation/reference/template_functions/miscellaneous/cache_block.

I already read these articles, but isnt there another way instead of defining "{cache-block expiry=0}". I thought of a global variable, the same variable which defines the default interval of two hours. This way I wouldnt have to add in every cache-block the expiry option. I assume that in nested cache-blocks the expiry option will not be inherited.
Also the reason for the default interval still isnt explained regarding to no occuring publish actions during this interval.

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Paul Forsyth

Saturday 11 September 2004 2:41:05 am

There should be but I dont think you can, without changing the kernel in some way :(

But, if have a modular design using several templates, say the top,menu,footer, etc it shouldnt be hard to add a few '{cache-block expiry=0 ignore_content_expiry} to the templates with real content.

paul

Michael Zeidler

Saturday 11 September 2004 3:17:21 am

Yes, you are right, it shouldnt be that hard to add these cache-blocks in the pagelayout.tpl.
But please explain me, why its not a good idea to add a cache-block around {$module_result.content}, as I have read somewhere here in this forum.
Concerning to the points mentioned above, i would go for this:

{cache-block expiry=0 keys=array($uri_string,$current_user.role_id_list|implode(','))}
  {$module_result.content}
{/cache-block}

It would also be interessting to know how to avoid clearing the whole cache initiated by a new forum entry. A new forum entry should only clear the cache of the page in which the entry is published of course.

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Michael Zeidler

Monday 13 September 2004 3:22:25 am

I have splited up these last questions into separate new topics:
http://ez.no/community/forum/general/cache_block_around_module_result_content
http://ez.no/community/forum/general/avoid_clear_caching_after_forum_reply

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Michael Zeidler

Tuesday 21 September 2004 12:43:15 am

Could someone be so kind and explain why there is a clear cache interval of two hours, which ignores the case that nothing is published?
thanks

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Hans Melis

Tuesday 21 September 2004 5:50:32 am

Apart from the whole issue about why there is a standard 2 hour interval, I do know where you can fiddle with the code to change the behaviour.

It's in a PHP file, so be careful when upgrading.

Look in: /lib/eztemplate/classes/eztemplatecachefunction.php line 357 and onwards. If you modify some code there you no longer need to specify the expiry parameter in each {cache-block}. That also means you can no longer make use of the expiry option. And a clearing of the cache on a higher level might still trigger a clearing of {cache-block}.

I've never done this before so I don't know what the exact results are. Don't complain if your whole ezp installation is ruined ;)

Hans
http://blog.hansmelis.be

Ole Morten Halvorsen

Tuesday 21 September 2004 5:57:00 am

The only cache which has a default timeout of two hours is cache-blocks. This can be overridden using the expire parameter. The cache might have to expire even though nothing has been published. An example would be a template operator pulling information from another source than the eZ publish database.

Another question is of course, should the default be two hours or nothing...?

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

Michael Zeidler

Tuesday 21 September 2004 10:55:21 pm

To clear the cache-block-cache every two hours makes no sense in regard to have the option to use the expiry-option. When someone wants to integrate other data sources he should know in what intervals the cache has to be purged, which should be up to him to configure this.
Actually the expiry=7200 and the default cache-block purge are redundant, with the limit that the default one isnt configurable. This way my CPU is frequently overheated every two hours with 98% of usage, even though nothing was published.
I would suggest to introduce a global CacheInterval variable in the site.ini which can also be set to 0 if desired.

with kind regards ...

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Michael Zeidler

Wednesday 22 September 2004 11:07:22 am

Thanks Hans,
$expiry is hardcoded twice in this file, which should be defined in the constructor as a member var. In IRC we figured out a couple of coding failurs. Have a look on this:

http://ez.no/community/bug_reports/undefined_member_variable_in_eztemplatecachefunction_php
http://ez.no/community/bug_reports/undefined_member_variables_in_eztemplateblockfunction_php

-------------------------------------------------------------------------------------------
join #ezpublish on irc.freenode.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.