Re: [opencms-dev] Re: Re: Re: need help: how improving opencmsperformance?

Christian Steinert christian_steinert at web.de
Wed Jan 31 18:23:25 CET 2007


Hi Andrea,

> I tried to apply your suggestion about cache property.
> I have a jsp whith different element included in it, and
> there is an element "menu" that i don't want to cache.
> i set the cache property in this way:
> 
> 
> cache: element=(anchor,anchorHead,foot,head,home,navigazione,style)
> 
> 
> but also the element not listed in the element directive, are cached. I 
> tried also using the directive no-params=(menu) but nothing changed.
> In the flexcache administration i have this:
> 
> 
> Resource: 
> /system/modules/com.gruppoatlantis.vp.templates/elements/pageselement.jsp 
> [online]   Key: no-params=(menu);element;
>         Variation: element=(anchor);
>         Variation: element=(anchorHead);
>         Variation: element=(foot);
>         Variation: element=(head);
>         Variation: element=(home);
>         Variation: element=(menu);
>         Variation: element=(navigazione);
> 
> what i have to do to exclude some resource from caching?

Personally, I have only used the cache directives 'true', 'elements' (without specifying any element names), 'locale', 'uri', 'parameters=(...)'. These settings seem to work as expected. The other directives I have not yet used ans so I cannot really say anything about them.

So I have not exactly tried what you are doing.
As I wrote before, I have individual JSP files for each caching strategy. These files have different settings for the cache-property and are included by my main templates via <cms:include>.

I have never tried to cache only some elements in a JSP file, I only say cache="elements" to tell opencms that the output of each element should become a different cache variant. 

If I cache something in a JSP file, then I cache all elements. Maybe someone else knows how to do this - if not, then you could try to move your cacheable elements to individual JSP files so that you can control caching individually there.

___

Also, I don't have the requirement to exclude elements from caching based on a parameter value. For my site, I use parameters to force opencms to create different versions of the same element for each parameter value by specifying parameters=(...) - directive. But I don't have the need for disabling the cache for some parameter values or as soon as a parameter appears. 

If you don't find a way to control this, then my only idea would be working around this problem as follows:
1. - you move your element that is cached only sometimes into a new JSP file (e.g. menu.jsp) and don't activate caching for this JSP
2. - you create two more files that include this file:
'menu-cache.jsp' (for this file you configure caching to be active by setting the cache property) and 'menu-nocache.jsp' (for this one you don't configure caching)

The code of these two files would only be:
  <cms:include file="menu.jsp" />

3. - in your main template you check your request parameter. Based on the parameter value, you either include menu-cache.jsp or menu-nocache.jsp 

In this way, the code of your main template could indirectly control the cache strategy for your element.

This may be a bit roundabout and I have not tried it, but I would expect this to work and this approach should give you the desired amount of control, if everything else fails.


hth
christian
_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos.
Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222




More information about the opencms-dev mailing list