Forums / Install & configuration / Disable caching on module/view level?

Disable caching on module/view level?

Author Message

Knut Urdalen

Sunday 04 November 2007 3:13:28 am

I've written some custom modules in my own extension which has a search form and a result when you call it. I set the state of the search form dynamically based on some input parameters from the query string (GET). The problem is that when I have enabled ViewCaching and TemplateCache (I'm not 100% sure what's the difference) it won't output the new template I've generated - it keep loading the previous template from the cache (the initial state of the form).

So the question is: Is it possible to have TemplateCache and ViewCaching enabled for the whole site, but filter out the dynamic parts and say: "Please do not cache these views"?

My typical production settings related to caching:

[ContentSettings]
ViewCaching=enabled
StaticCache=disabled

[DebugSettings]
DebugOutput=disabled
DebugRedirection=disabled

[TemplateSettings]
Debug=disabled
ShowXHTMLCode=disabled
ShowUsedTemplates=disabled
TemplateCompile=enabled
TemplateCache=enabled

André R.

Sunday 04 November 2007 6:45:10 am

ViewCache is cache for the content/view module, so has no effect on your custom module.
TemplateCache is the global setting for en/disabling cache-blocks, you can control your cache blocks from within your templates.

http://ez.no/doc/ez_publish/technical_manual/3_10/reference/template_functions/miscellaneous/cache_block

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

Knut Urdalen

Monday 05 November 2007 5:42:34 am

Thanks for explaining the difference :)

I've tested a bit more now and enabling ViewCaching works fine. I use {cache-block} around the top menu and a site map at the bottom in pagelayout.tpl, while the {$module_result.content} do not use the cache-block mechanism.

However I have to set TemplateCache=disabled in order to get the result I want. My module script looks like this:

<?php
// 1. do stuff

// 2. setting some template variables
$tpl->setVariable('result', $result);
$tpl->setVariable('access_type', $GLOBALS['eZCurrentAccess']);

// 3. prepare result
$Result = array();
$Result['content'] = $tpl->fetch('design:mymodule/search_result.tpl');
?>

as described in this tutorial: http://ez.no/ezpublish/documentation/development/extensions/module/module_tutorial_part_1.

$result contains the correct new values, but those values is not set in $tpl->fetch() - the template remains in the previous state (when TemplateCache=enabled). Any ideas?

Knut Urdalen

Monday 05 November 2007 6:00:15 am

A related question to this topic is how can you include dynamic data from a custom fetch function inside a node template if you want to use ViewCaching in general, but some parts on some pages should not use it?

Use case: A content node includes some general meta data, but in addition you want to display some related content from an external data source that changes every minute.

Currently I use a node template with a custom fetch function - when ViewCaching=enabled the dynamic content remains in the view cache, while ViewCaching=disabled it's fetched again.

Any hints or tips?

Sujit Sth

Tuesday 04 January 2011 9:13:59 pm

Disable cache

Follow the following instruction.

1. Go to your template file:
eg:
E:\xampp\htdocs\ezpublish\settings\siteaccess\your_site\site.ini.append.php

2. Place the following code:

[DebugSettings]

DebugOutput=enabled

DebugRedirection=disabled

DebugToolbar=disabled

DebugByIP=disabled

DebugByUser=disabled

[TemplateSettings]

TemplateCompile=disabled

TemplateCache=disabled

DevelopmentMode=disabled

ShowUsedTemplates=enabled

Debug=disabled

ShowXHTMLCode=disabled

[ContentSettings]

ViewCaching=disabled

[DatabaseSettings]

SQLOutput=disabled

[DebugSettings]

DebugOutput=enabled

DebugRedirection=disabled

DebugToolbar=disabled

DebugByIP=disabled

DebugByUser=disabled

[TemplateSettings]

TemplateCompile=disabled

TemplateCache=disabled

DevelopmentMode=disabled

ShowUsedTemplates=enabled

Debug=disabled

ShowXHTMLCode=disabled

[ContentSettings]

ViewCaching=disabled

[DatabaseSettings]

SQLOutput=disabled

<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; white-space: normal; font-size: 13px; " mce_fixed="1">Go and enjoy the code !!!!!!</span>

For detail follow the link below:

http://blog.developeronhire.com/tag/disble-cache/

Regards,

Sujeet

eZ debug

Timing: Jan 17 2025 23:40:58
Script start
Timing: Jan 17 2025 23:40:58
Module start 'content'
Timing: Jan 17 2025 23:40:58
Module end 'content'
Timing: Jan 17 2025 23:40:58
Script end

Main resources:

Total runtime0.1371 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 587.8359180.8203
Module start 'content' 0.00530.0042 768.6563102.1484
Module end 'content' 0.00950.1276 870.8047530.8281
Script end 0.1370  1,401.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.4218200.0002
Check MTime0.00130.9775200.0001
Mysql Total
Database connection0.00080.546910.0008
Mysqli_queries0.095269.40981410.0007
Looping result0.00130.91821390.0000
Template Total0.127392.810.1273
Template load0.00070.539610.0007
Template processing0.126592.271010.1265
Override
Cache load0.00050.371810.0005
Sytem overhead
Fetch class attribute can translate value0.00060.451310.0006
XML
Image XML parsing0.00030.210710.0003
General
dbfile0.00251.7942200.0001
String conversion0.00000.004530.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.0002 secs