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
|