eZ Flow - Refresh cache for a special block type periodically

Author Message

Kelly Milligan

Friday 10 September 2010 9:44:45 am

Ez publish 4.3

Latest version of ez flow.

I have a block that fetches upcoming events in the calendar for the site. the challenge is that I need it to refresh it's own cache every hour, so that events that are in the past are not shown. I have tried similar approaches from regular node templates, such as:

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

and having a {cache-block} around the fetch code in order to have it refresh it's cache on a timed basis with the expiry, but it doesn't seem to be working. when I create new events and expire the event(make it in the past), the frontpage is updated through the view cache settings, which works great.

any ideas on this?

also, the ezflowupdate cronjob is running every minute, and this doesn't help either.

here's the full template:

{set-block scope=root variable=cache_ttl}0{/set-block}
{def $today = currentdate()}
{def $events = fetch( 'content', 'list',
hash( 'parent_node_id', $block.custom_attributes.subtree_node_id,
'class_filter_type', 'include',
'class_filter_array', array('event'),
'sort_by', array('attribute',true(),'event/from_time'),
'attribute_filter', array(array('event/from_time','>',$today)),
'limit', 20))}
{def $calendar_node = fetch( 'content', 'node', hash( 'node_id', $block.custom_attributes.subtree_node_id))}
{cache-block keys=$block.id expiry=1800}
<div class="homepage-promo-module">
<h4><a href="{$calendar_node.url|ezurl(no)}">{$block.name}</a></h4>
<div class="content-container wrapper">
<ul>
{foreach $events as $event}
<li>
<a href="{$event.url|ezurl(no)}">{$event.data_map.short_title.content|wash()}</a> |
{$event.data_map.category.content.keyword_string} |
{$event.data_map.from_time.content.timestamp|l10n('date')}
</li>
{/foreach}
</ul>
</div>
</div>
{/cache-block}

SEBBANE Alexandre

Saturday 18 September 2010 8:45:00 pm

Hello

i 'm a great cahe expert but do you try to delete the {cache-block keys=$block.id expiry=1800} because you ask not to have caceh on the fetch and you set a cache in the array traitment.

i hope it's help..

Alex

Paris, France

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