[opencms-dev] Cache problem with cms:include

Tobias Karrer kartobi at gmail.com
Sun Jul 7 15:39:45 CEST 2013


Hi Achim,

Am 06.07.2013 18:44, schrieb Achim Westermann:
> Hi Tobias,
>
>
>
>> What about the attribute "cacheable" of the cms:include-Tag?
>>
>> So far we used cms:include to include parts of a page which mustn't be
>> cached... worked very well with 7.5.4.
>>
>> If this isn't working any more it's preferable to use static includes,
>> because they're much more faster.
>>
> There is nothing about cache "not working any more". That part of
> OpenCms is pretty deep-down, stable and untouched. I am not writing that
> from my current knowledge but from my experience with OpenCms. But my
> "feeling" tells me that this issue is worthwhile to dig deeper why
> something in your webapp did work and now does not. As opposed to say
> "It worked in 7.5.4, in 8 it does not. So the latest version has issues."
>
> Static includes are not faster if you want to use caching. Those will
> not make use of any caching at all but be included in the jsp
> compilation phase. Think of a jsp that performs heavy database
> operations being included statically: That code will get executed for
> every call.
> OK, static includes are faster, if you do not want to cache at all. But
> do you want that? You can even set the OpenCms cache to have a timeout
> in minutes. Pretty mighty. It is worth spending some time on the OpenCms
> cache setting.  Cache is king. Dropping caching may only work if you buy
> faster hardware. And may always be compromised by the intensity of DOS
> attacks.
Thanks for yopur answer.
I agree complete "Cache is king". But still there are pages or parts of 
pages, which you don't want to be cached, and I'm looking for a good way 
to exclude thes parts from caching.

I meanwhile did different tests with cms:includes, to see why the 
different behaviour occurs.
Finally: there has been a small change, so the cache-setting for a 
session attibute behaves a little different. In some especial 
circumstances the problem will have occured in 7.5.4 as well. So not the 
updateto Version 8 itself was responsible.

>> Or what to do to exclude parts of a page from caching?
> Set property cache to "never" on a jsp. And then be flexible to decide
> to cache the output of that jsp later on properly.
Clearly, but what if this jsp includes other jsps, which I don't want to 
be cached.

Example:
/mysite/dynamic-include.jsp (cache=never) with "Time in Millis: <%= 
|System.currentTimeInMillis() %>|"
/mysite/page.jsp (cache=uri) which contains "<cms:include 
cacheable="false" file="/mysite/dynamic-include.jsp"/>"

With the first call of "/mysite/page.jsp" both pages are compiled an the 
final HTML-Markup ends up in the FlexCache.
For the second call the whole page will be delivered by FlexCache. Time 
in Millis always will be the compilation time (until FlexCache is purged)

Or am I wrong?

Greeting,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130707/06ac0692/attachment.htm>


More information about the opencms-dev mailing list