Forums / Setup & design / Cache and random

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/

eZ debug

Timing: Jan 19 2025 09:59:31
Script start
Timing: Jan 19 2025 09:59:31
Module start 'content'
Timing: Jan 19 2025 09:59:31
Module end 'content'
Timing: Jan 19 2025 09:59:31
Script end

Main resources:

Total runtime0.1471 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.8516180.8438
Module start 'content' 0.00630.0057 769.695397.8672
Module end 'content' 0.01210.1350 867.5625522.7500
Script end 0.1470  1,390.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.3665200.0002
Check MTime0.00140.9512200.0001
Mysql Total
Database connection0.00080.521410.0008
Mysqli_queries0.102669.75621410.0007
Looping result0.00130.86201390.0000
Template Total0.134591.510.1345
Template load0.00090.579910.0009
Template processing0.133790.874010.1337
Override
Cache load0.00060.422010.0006
Sytem overhead
Fetch class attribute can translate value0.00070.500310.0007
XML
Image XML parsing0.00030.172610.0003
General
dbfile0.00614.1604200.0003
String conversion0.00000.004230.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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