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.