May 17

If you are using hibernate or ejb, am sure you cache your entities using either ehcahce or JTreeCache or some other cache available. But to boost the performance you could also cache your pages or some fragments like some includes.

For my application i have used ehcache .. and for that everything is explained in detail here

The only problem i encountered was that it also cached my post request .. in order to exclude all my post request from being cached i overrode the methode caclulatekey to return null for post requests .. Am sure there is some configuration variable which one could set in the web.xml or ehcache.xml but i was to lazy to search ;) ..

protected String calculateKey(HttpServletRequest httpRequest) {
        if (httpRequest.getMethod().equals("POST"))
            return null; ...

You could then use some custom tag for caching some parts of your page. for e.g seam has a tag you could also have a tag similar to that and cache your page fragments.

Tagged with:
preload preload preload