Forums / Setup & design / Cache-block and ezhttp get variables problem

Cache-block and ezhttp get variables problem

Author Message

Radek Kuchta

Thursday 29 November 2007 12:47:41 am

I have a problem with a cache-block and ezhttp variables.
I have a tamplate where I'm using these ezhttp get variables (with my form) and the teplate has view cache disabled.

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

Everything works ok but when I'm displaing the page with my form and variables, everytime I have 23 sql queries. I would

like to have less so I used the cache-block with array keys as my http get variable. Unfortunately cache-block doesn't

work as I expected.

{cache-block key=array($offest, $get1, $get2, $get3, $get4 )}
... form and results ...
{/cache-block}

Once the viewed page has been displayed, I keep geeting the same result, even if the cache keys ($get1, $get2 etc...) change. Just as if they were not used.

Is it possible to use cache-block with that (eZ 3.10.0)?

http://ez.no/certification/verify/272582

Hans Melis

Thursday 29 November 2007 2:44:37 am

First thing I notice (it could just as well be a typo in your post) is that you use <b>key=</b> in the cache block statement, but the documentation says it's <b>keys=</b>.

If the typo is only in your post, what is the value of $get1 to $get4? Do those variables contain the name of the GET variable or do they contain the value of the GET variable?

Hans
http://blog.hansmelis.be

Paul Leclercq

Thursday 29 November 2007 3:14:08 am

personnaly I would drop the idea of using that line altogether:
{set-block scope=root variable=cache_ttl}0{/set-block}

This will simply remove the cache on your page, and will really require far too much processing power on your servers. and then re-include the cache manually, for a set of area.

You would be better off, converting your parameters into view_parameters if you can:
http://ez.no/doc/ez_publish/technical_manual/3_10/templates/basic_template_tasks

Or create a module view extension to collect the information from your form. That way you can collect the information in the script of the page, and cache the result page.
http://ez.no/fr/ezpublish/documentation/development/extensions/building_an_ez_publish_module

If you really want to use cache blocks, you would be better of using it the other way round. use a cache-block to unset the cache for one area, not for the entire page and then ressetting it for every part.

Radek Kuchta

Thursday 29 November 2007 3:20:39 am

Hi Hans,

Statement "key" was a typo only. I'm using keys array.

$get1 - $get4 variables contain the value of ezhttp get variable (if it is set, if no then the value is eq 0). For exemple code before cache-block:

{if ezhttp_hasvariable( 'name_1, 'get' )}
	{set $get1 = ezhttp( 'name_1', 'get' )}
{else}
	{set $get1 = 0}
{/if}

http://ez.no/certification/verify/272582

eZ debug

Timing: Jan 19 2025 06:21:05
Script start
Timing: Jan 19 2025 06:21:05
Module start 'content'
Timing: Jan 19 2025 06:21:06
Module end 'content'
Timing: Jan 19 2025 06:21:06
Script end

Main resources:

Total runtime0.9970 sec
Peak memory usage4,096.0000 KB
Database Queries199

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.0859180.8125
Module start 'content' 0.00640.8045 769.8984603.5391
Module end 'content' 0.81080.1861 1,373.4375337.3672
Script end 0.9969  1,710.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4022210.0002
Check MTime0.00150.1487210.0001
Mysql Total
Database connection0.00080.079410.0008
Mysqli_queries0.911691.43621990.0046
Looping result0.00230.23431970.0000
Template Total0.969697.320.4848
Template load0.00240.241420.0012
Template processing0.967197.008720.4836
Template load and register function0.00010.013010.0001
states
state_id_array0.00080.076310.0008
state_identifier_array0.00100.103320.0005
Override
Cache load0.00200.2052350.0001
Sytem overhead
Fetch class attribute can translate value0.00140.144340.0004
Fetch class attribute name0.00120.122070.0002
XML
Image XML parsing0.00410.411140.0010
class_abstraction
Instantiating content class attribute0.00000.003580.0000
General
dbfile0.00660.6596370.0002
String conversion0.00000.000830.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/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
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs