Forums / Developer / Cache problem

Cache problem

Author Message

Fabien Mas

Tuesday 24 July 2007 12:20:41 am

Hi
I would like to put a randomized article in my front page.
So I need to create a new template which is not cached to change each time the randomized article.
But I can't find a way ...

here is my pageloayout.tpl

... {cache-block keys=array($uri_string)}
        .... {include uri='design:my_area.tpl' area=$iag_bottom position='Bottom'} ...
{/cache-block}

here is : my_area.tpl

{section var=tool loop=$area}
  {let tool_template='design:area/'|concat($tool.template)}
    {* I CALL HERE MY RANDOMIZED ARTICLE *}
    {include uri=$tool_template elt=$tool.elt position=$position
             contextual=$tool.contextual}
  {/let}
{/section}

And now here is : randomized_article.tpl

{set-block scope=root variable=cache_ttl}0{/set-block} 
{cache-block keys=array($elt.main_node_id,"article_aleatoire") expiry=1}
	{def $list_count=fetch('content', 'list_count', hash(parent_node_id, $elt.main_node_id))
		 $aleat=rand(0,sub($list_count,1))
		 $random=fetch('content','list',hash(parent_node_id,$elt.main_node_id,
		     								limit,1,
		     								offset,$aleat))}								
	<div id="zoom_random">	     								
		{node_view_gui content_node=$random[0] view=line}
	</div>
	
	{undef $list_count $aleat $random}
{/cache-block}

I tried a lot of different codes, but nothing is working ..

thx for any help
Fabien

Donat Fritschy

Friday 27 July 2007 9:51:43 am

Hi Fabien

The outer cache block caches everythig inside, wether this itself is cached or not.

Try using two cache blocks: one above, one below the uncached segment.

Regards
Donat

http://www.webmanufaktur.ch - Developers united in eZ Publish: http://www.cjw-network.com

eZ debug

Timing: Jan 18 2025 19:19:16
Script start
Timing: Jan 18 2025 19:19:16
Module start 'content'
Timing: Jan 18 2025 19:19:18
Module end 'content'
Timing: Jan 18 2025 19:19:18
Script end

Main resources:

Total runtime1.2303 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 588.6953180.8516
Module start 'content' 0.00761.0893 769.5469535.1953
Module end 'content' 1.09690.1332 1,304.7422332.7734
Script end 1.2301  1,637.5156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.3757210.0002
Check MTime0.00210.1678210.0001
Mysql Total
Database connection0.00190.156310.0019
Mysqli_queries1.158594.17081910.0061
Looping result0.00200.16291890.0000
Template Total1.193597.020.5968
Template load0.00280.226220.0014
Template processing1.190896.789020.5954
Template load and register function0.00020.015110.0002
states
state_id_array0.00130.107510.0013
state_identifier_array0.00080.064820.0004
Override
Cache load0.00240.1934230.0001
Sytem overhead
Fetch class attribute can translate value0.00120.093630.0004
Fetch class attribute name0.00100.080830.0003
XML
Image XML parsing0.00090.071030.0003
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00300.2470270.0001
String conversion0.00000.000530.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0004 secs