Cache and random

Author Message

Andreas Kaiser

Wednesday 23 July 2008 1:09:28 pm

Hi,

I'm using following code inside a template called from the pagelayout.tpl in ezp 4:

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

<div id="banner">
{def $nrbanners=fetch( 'content', 'tree_count', hash( 'parent_node_id', 358, 'class_filter_type', 'include', 'class_filter_array', array('banner') ) )}
{def $randombanner=fetch( 'content', 'tree', hash( 'parent_node_id', 358, 'class_filter_type', 'include', 'class_filter_array', array('banner'), 'offset', rand(0, dec($nrbanners)), 'limit', 1 ) )}
{content_view_gui content_object=$randombanner[0] view=random}
{undef $nrbanners $randombanner}
</div>

This code is working in other sites (same install), but in this case random isn't working. first time loaded object is show every refresh.

Any ideas?

Anyway with TemplateCache=disabled in site.ini random works.

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

André R.

Wednesday 23 July 2008 1:24:54 pm

cache_ttl is for setting view cache timeout(the one used on node templates), no effect on cache-blocks what so ever.

How much is performance a concern on this site?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Andreas Kaiser

Wednesday 10 September 2008 11:22:36 am

It's not a high load site, so performance is not a problem...

Is there any alternative for displaying random content with cache enabled? I've tried "shuffle" extension and same problem...

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

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 19 2025 00:19:46
Script start
Timing: Jan 19 2025 00:19:46
Module start 'layout'
Timing: Jan 19 2025 00:19:46
Module start 'content'
Timing: Jan 19 2025 00:19:46
Module end 'content'
Timing: Jan 19 2025 00:19:46
Script end

Main resources:

Total runtime0.0296 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.0083 587.8125152.6094
Module start 'layout' 0.00830.0038 740.421939.4141
Module start 'content' 0.01210.0152 779.835993.3359
Module end 'content' 0.02730.0022 873.171934.3047
Script end 0.0296  907.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00289.4354140.0002
Check MTime0.00124.1962140.0001
Mysql Total
Database connection0.00134.469010.0013
Mysqli_queries0.003611.992230.0012
Looping result0.00000.067610.0000
Template Total0.00175.910.0017
Template load0.00093.156410.0009
Template processing0.00082.710510.0008
Override
Cache load0.00072.230910.0007
General
dbfile0.005016.925580.0006
String conversion0.00000.026640.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.0013 secs