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.

eZ debug

Timing: Jan 18 2025 02:10:43
Script start
Timing: Jan 18 2025 02:10:43
Module start 'layout'
Timing: Jan 18 2025 02:10:43
Module start 'content'
Timing: Jan 18 2025 02:10:43
Module end 'content'
Timing: Jan 18 2025 02:10:43
Script end

Main resources:

Total runtime0.0155 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.2891152.6563
Module start 'layout' 0.00490.0032 741.945339.5078
Module start 'content' 0.00810.0047 781.453189.3984
Module end 'content' 0.01290.0025 870.851634.3047
Script end 0.0154  905.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002817.8813140.0002
Check MTime0.00127.6331140.0001
Mysql Total
Database connection0.00074.457210.0007
Mysqli_queries0.002818.006130.0009
Looping result0.00000.174010.0000
Template Total0.002113.510.0021
Template load0.00138.534110.0013
Template processing0.00084.922410.0008
Override
Cache load0.00095.980510.0009
General
dbfile0.00031.694280.0000
String conversion0.00000.070840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs