[opencms-dev] Cache problem with cms:include

Tobias Herrmann t.herrmann at alkacon.com
Mon Jul 8 18:51:54 CEST 2013


Hi Tobias,

to test this, I also created a JSP printing System.currentTimeInMillis() and set the property cache=never. I used <cms:include file="myjsp.jsp" /> to include the JSP. This works fine.
I actually never used the attribute cachable with the cms:include tag. I think you don't need it.

Greetings, Tobias

--

Alkacon Software GmbH - The OpenCms Experts

http://www.alkacon.com
http://www.opencms.org

Am 08.07.2013 18:28, schrieb Tobias Karrer:
> Gets quite confusing for me now...
>
> What I did:
>
> /mysite/dynamic-include.jsp (cache=never) with content "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)
>
> What I want:
>
> Each time I call "/mysite/page.jsp", Time-in-Millis will be the current time, the rest of the page shall be cached.
>
> As far as I can see at the moment, that's not possible.
> (Or I didn't get what I'm doing wrong)
>
> Best,
> Tobias
>
>
> Am 08.07.2013 16:16, schrieb Tobias Herrmann:
>> Hi Tobias,
>>
>> using the cache property set to 'never' on the JSP work fine for me. How are you doing it?
>>
>> Greetings, Tobias
>>
>> --
>>
>> Alkacon Software GmbH - The OpenCms Experts
>>
>> http://www.alkacon.com
>> http://www.opencms.org
>>
>> Am 07.07.2013 15:39, schrieb Tobias Karrer:
>>> 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
>>>
>>>
>>> _______________________________________________
>>> This mail is sent to you from the opencms-dev mailing list
>>> To change your list options, or to unsubscribe from the list, please visit
>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>
>>>
>>>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>



More information about the opencms-dev mailing list