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

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 07:21:47
Script start
Timing: Jan 19 2025 07:21:47
Module start 'layout'
Timing: Jan 19 2025 07:21:47
Module start 'content'
Timing: Jan 19 2025 07:21:48
Module end 'content'
Timing: Jan 19 2025 07:21:48
Script end

Main resources:

Total runtime1.1753 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.2891152.6406
Module start 'layout' 0.00640.0025 741.929739.4766
Module start 'content' 0.00901.1651 781.4063598.4453
Module end 'content' 1.17400.0012 1,379.851612.1250
Script end 1.1752  1,391.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2923160.0002
Check MTime0.00130.1141160.0001
Mysql Total
Database connection0.00080.067710.0008
Mysqli_queries1.115494.9100620.0180
Looping result0.00070.0567600.0000
Template Total1.143897.320.5719
Template load0.00220.190220.0011
Template processing1.141697.134620.5708
Template load and register function0.00010.010210.0001
states
state_id_array0.00090.077310.0009
state_identifier_array0.00120.099320.0006
Override
Cache load0.00180.1529350.0001
Sytem overhead
Fetch class attribute can translate value0.00050.042630.0002
Fetch class attribute name0.00110.096770.0002
XML
Image XML parsing0.00290.250230.0010
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00310.2613260.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs