Is there an ehcache jsp tag?
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
won't help either.
What I am looking for is something like this:
<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 开发者_StackOverflowto 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.
There existed two tag libraries for this: Jakarta Cache and OpenSymphony OSCache. Both are retied and the Jakarta Cache library is nowhere available for download, but you can still download the OSCache library here: 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>
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.
I believe the answer is no, such a beast does not exist.
There's an enhancement request open for this http://jira.terracotta.org/jira/browse/CDV-1617 I recommend voting for it.
精彩评论