eZ Community » Forums » Setup & design » eZ Flow - Refresh cache for a special...

eZ Flow - Refresh cache for a special block type periodically

eZ Flow - Refresh cache for a special block type periodically

Friday 10 September 2010 6:44:45 pm - 1 reply

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">
{foreach $events as $event}
<a href="{$event.url|ezurl(no)}">{$event.data_map.short_title.content|wash()}</a> |
{$event.data_map.category.content.keyword_string} |

Modified on Friday 10 September 2010 6:48:32 pm by Kelly Milligan

Sunday 19 September 2010 5:45:00 am


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..



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

36 542 Users on board!

Forums menu

Proudly Developed with from