On 11-12-09 06:19 PM, mck wrote:
We could also imagine a "CachingRenderer" with a
"CachingRequestWrapper", caching HTML fragments for performance (ehcache
has a solution to do it using ServletFilters, but... let's just say I
think tiles can do a better job of it).

Ok. now you have me really interested! if you can provide a prototype of
this you definitely got me on-board.


I hacked a quick proof of concept here: https://github.com/nlebas/tiles/tree/fragment-cache-poc. It's definitely lacking in many regards, but the basic mechanism should be here.

If you write something like this in tiles.xml, the result of evaluating the attribute should get cached:
<definition name="test" template="/test.jsp">
   <put-attribute name="no-cache"
      value="/no-cache.jsp"/>
   <put-attribute name="cache"
      lastModified="${requestScope.lastModified}"
      value="/cache.jsp" />
</definition>

To implement it cleanly we need a lot more abstraction: several RequestWrapper implementations to vary the caching implementations, and probably a renderer to host the code I've hacked into BasicTilesContainer. But then again, that's the basic mechanism.

Hope this helps,
Nick

Reply via email to