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.

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 31 2025 00:39:18
Script start
Timing: Jan 31 2025 00:39:18
Module start 'layout'
Timing: Jan 31 2025 00:39:18
Module start 'content'
Timing: Jan 31 2025 00:39:18
Module end 'content'
Timing: Jan 31 2025 00:39:18
Script end

Main resources:

Total runtime0.0189 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0036 588.3750151.2422
Module start 'layout' 0.00360.0028 739.6172220.7500
Module start 'content' 0.00640.0108 960.36721,001.9609
Module end 'content' 0.01720.0017 1,962.328133.9922
Script end 0.0189  1,996.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002312.4052140.0002
Check MTime0.00105.2049140.0001
Mysql Total
Database connection0.00063.137810.0006
Mysqli_queries0.00168.380630.0005
Looping result0.00000.042810.0000
Template Total0.00126.310.0012
Template load0.00094.993310.0009
Template processing0.00021.247110.0002
Override
Cache load0.00063.418710.0006
General
dbfile0.00021.056980.0000
String conversion0.00000.036540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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