¿Existe una etiqueta jsp ehcache?

In a current project of mine, JSPs are getting huge (lots of jstl end el logic, no Java), and due to increasing traffic, caching on many levels has become a necessity. Some components need to be dynamic, so we won't be able to use filter-based solutions. Unfortunately, the logic uses many custom tags and hardly ever uses includes, so SimplePageFragmentCachingFilter tampoco ayudará.

Lo que estoy buscando es algo como esto:

<ehcache:cache key="${myApp.cacheKey}">
    <many />
    <jsp />
    <tags />
    <here />
</ehcache:cache>

This tag would expose a virtual writer for pageContext.out and flush that writer to the cache and the page and on subsequent requests would write directly from the cache to pageContext.out.

Does any such beast exist?

Hint: I know we should change the design, reduce logic in JSPs etc. Unfortunately, it won't happen. I'm not the one making decisions here, so please don't go there. Oh, and: yes, I have googled it.

preguntado el 28 de septiembre de 11 a las 08:09

I have seen such a mechanism used to cache the results of entire JSPs. But that was inside a proprietory content management system called CoreMedia. -

@nfechner but was it a tag inside the JSP or was it a mechanism that cached he JSP invocation from the outside? -

The second case. Caching the entire JSP. So I don't think that solution will help you. -

@nfechner ok, that's roughly equivalent to the SimplePageFragmentCachingFilter I mentioned in the question, then -

>Does any such beast exist? As OSCache is no more supported (its jsp tag did the trick), I think that the answer is unfortunatly NO. But I'm still searching for ... -

4 Respuestas

There existed two tag libraries for this: Jakarta Cache y OpenSymphony OSCache. Both are retied and the Jakarta Cache library is nowhere available for download, but you can still download the OSCache library aquí: OSCache 2.4.

It's supposed to be used as follows (after you just drop the JAR in /WEB-INF/lib the usual way):

<%@taglib prefix="oscache" uri="http://www.opensymphony.com/oscache" %>
...
<oscache:cache key="${myApp.cacheKey}">
    <many />
    <jsp />
    <tags />
    <here />
</oscache:cache>

Respondido 26 Oct 11, 17:10

I made such a thing: https://github.com/psiegman/ehcachetag

Haven't used it on a production system yet, but it has decent code coverage.

Respondido el 08 de enero de 14 a las 13:01

Can you publish a maven artifact in a public repo? Even a snapshot release would be helpful. - Puerta

I believe the answer is no, such a beast does not exist.

Respondido el 28 de Septiembre de 11 a las 12:09

And I believe this should have been a comment. - Sean Patrick Floyd

Sean, usually I would make this a comment. But in this case, I'm quite sure that this is the correct answer to the question. The JSP mechanism for generating output almost certainly won't allow this concept. - Steve McLeod

Since you can write jsp output into a variable, there is nothing preventing such thing. - Vadim Ferderer

There's an enhancement request open for this http://jira.terracotta.org/jira/browse/CDV-1617 I recommend voting for it.

Respondido el 07 de junio de 12 a las 06:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.