eZ Community » Forums » Setup & design » Cache-block expiration problem...
expandshrink

Cache-block expiration problem (Community Project 2011.10)

Cache-block expiration problem (Community Project 2011.10)

Thursday 26 January 2012 2:08:43 pm - 3 replies

Hi,

In pagelayout.tpl, I include a template a.tpl which includes the template b.tpl. b.tpl is generated using a cron file every day, so I am using a cache-block so that the content of b.tpl is cached every day:
pagelayout.tpl
...
{include uri='design:a.tpl'}
...
a.tpl
...
{cache-block expiry="86400"}
  {include uri='design:b.tpl'}
{/cache-block}
...
The problem is that this cache-block *sometimes* does not expire (or worse an old b.tpl file generated a few days ago is sometimes displayed!).
If I remove the cache-block around :
  {include uri='design:b.tpl'}
I thought that the latest version of b.tpl is supposed to be parsed on every request, but I always see the content of b.tpl parsed at the last time I cleaned the whole cache using the admin interface.
TemplateCache and ViewCache (+SmartCacheClear and PreViewCache) are enabled.
Similar problem here:
http://share.ez.no/forums/setup-d...ache-block-problem/(language)/eng-GB
Thanks in advance for any help,
Mathieu

Thursday 26 January 2012 3:08:51 pm

You probably have "TemplateCompile=enabled" (which enables compiling templates to PHP code) and "DevelopmentMode=disabled" (When enabled the system will perform more checks like modification time on compiled vs source file).

Both of these settings are normal on live setup due to speed.

In your case you change the template but when eZ uses the compiled version it doesn't check if the tpl was changed. To verify this you can try to set  "DevelopmentMode=disabled" but it is not a solution as it  could decrease performance.

I would suggest not to generate templates but to create a simple template operator which can read the variable data from some file generated by cron.

Modified on Thursday 26 January 2012 3:09:37 pm by Ivo Lukac

Thursday 26 January 2012 9:48:16 pm

Hi,

TemplateCompile is indeed enabled. I have tried to enable DevelopmentMode but the problem still occurs. I will try to generate the variable data using template operator as you suggest, so I can use always the same template file.

Thanks,

Mathieu

Monday 30 January 2012 9:07:01 pm

Hi,

I confirm the problem is solved: cache is working as expected using a template operator.

Mathieu

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu