Ad-Hockery

ad-hockery: /ad·hok'@r·ee/, n.
Gratuitous assumptions... which lead to the appearance of semi-intelligent behavior but are in fact entirely arbitrary. Jargon File

Page fragment caching with Grails Springcache plugin

Yesterday I released the new version of the Springcache plugin for Grails. The new feature this brings to the table is page fragment caching driven by annotations on controller actions. The feature is based on EhCache Web and is even simpler and more powerful than the full page caching I blogged about recently.

With the page fragment caching feature you can:

  • Define @Cacheable and @CacheFlush annotations on controller actions.

  • Have SiteMesh decorate cached and uncached output alike.

  • Use SiteMesh to mix dynamic page sections with cached sections.

  • Use SiteMesh and <g:include> to have multiple areas of the page that are cached and flushed independently of one another.

  • Cache the output of controller actions that use content negotiation separately according to the requested format.

There are some examples in the plugin documentation and the plugin source code has a test project with a variety of page fragment caching mechanisms used and tested.

Web Statistics