Forums / Setup & design / Chache settings and custom module for search and filter

Chache settings and custom module for search and filter

Author Message

Jan Komárek

Tuesday 17 March 2009 12:31:21 pm

I created new module for handling my custom search/filter form. But I have problem with cache. When I enabled view cache, template compile, template cache. (no static cache) My filter start returns first cached result.

So i have question how to make my filter alive. I have seen cache-block and set-block but I still dont know how to do it.

I am usintg EZ Publish 4, EZC 2008.1 and EZ Webin.

Thaks for replies.

Fátima Chapri

Wednesday 18 March 2009 1:12:46 pm

Hi Jan,

I had a similar problem and solved it removing all the cache blocks from "pagelayout.tpl" because the search form was there and inside a cache block.

But I think this is not the best solution. I still don't understand the importance of the cache blocks, but somehow they have a functionality.

I think you should check if your search form is inside a cache block or not.

Jean-Yves Zinsou

Wednesday 18 March 2009 3:12:53 pm

Hi Fatima and Jan,
cache block are important regarding to performance. Let me try to explain :
1-The template code is transformed to php code (template compile)->slow
2-the php code is executed and transformed in html to render the page (the html code is stored as cached files)->heavy processing

The next time you access this page if there are no event relatives to content modification (like editing a node), the cached html is served without computing (very fast) if the cache files are less than 2hours old .

The cache block allows you to modify this behaviour by avoiding headers recomputations in pagelayout, having a set of cache files per user, etc....

It is always a good idea to keep in mind the optimization available with cache blocks, you should not remove them all.
If you have a problem with a block code , before removing the caches try to split it a part of the block code involved:
Example:

{cache-block key=$user_hash}
bla bla
{*start / block of code troubling your mind *}
blobloblo
{*end / block of code troubling your mind *}
{/cache-block }
blibli
 

could be turned into:

{cache-block key=$user_hash}
bla bla
{/cache-block }
{*start / block of code troubling your mind *}
blobloblo
{*end / block of code troubling your mind *}
{cache-block key=$user_hash}
blibli
{/cache-block }
 

But, be careful, variables defined inside a cache block are not available outside this bloc.

I hope i have been clear enough, if not, maybe i gave you the interest of discovering how caching block can be of great benefit for designing fast page rendering applications.

See there for an ez guru explanation :
http://ez.no/developer/articles/ez_publish_performance_optimization_part_3_of_3_practical_cache_and_template_solutions/cache_blocks_optimization

have fun!

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Fátima Chapri

Friday 20 March 2009 11:38:11 am

Hi, Jean-Yves

Thanks a lot for the explanation. You just made my day.

By the way Jan, did u solve your problem? Can you please share with us how did u solve it.

Thanks again for all ez fellows. I've been learning a lot in the ez publish forums.

eZ debug

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

Main resources:

Total runtime0.1569 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.0054 589.3828180.8125
Module start 'content' 0.00540.0049 770.195398.0703
Module end 'content' 0.01030.1465 868.2656526.1250
Script end 0.1568  1,394.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00332.1103200.0002
Check MTime0.00140.8767200.0001
Mysql Total
Database connection0.00060.408010.0006
Mysqli_queries0.115473.56091410.0008
Looping result0.00130.80181390.0000
Template Total0.146293.210.1462
Template load0.00080.493410.0008
Template processing0.145492.711910.1454
Override
Cache load0.00050.348110.0005
Sytem overhead
Fetch class attribute can translate value0.00060.399010.0006
XML
Image XML parsing0.00020.145310.0002
General
dbfile0.00181.1655200.0001
String conversion0.00000.002630.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