Announcement Announcement Module
No announcement yet.
Fragment caching in Spring MVC Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fragment caching in Spring MVC


    I've been working with Spring MVC (with Sitemesh) for a while now and I would like to start using a page fragment cache.

    Most element of pages can be reused and only so much needs to be created on the fly.

    The challenge I see here is that Spring is very top down page oriented. Everything flows from the controller and it doesn't make much sense caching a page fragment when all the database interaction, supported or not by a cache, happens anyway. And with tools such as Hibernate it can sometimes be quite hard to avoid a lot of unnecessary query overhead.

    I am wondering what strategies could be employed and what experiences people have with this?

    Some options I see:
    * Create "mini-controllers" that create parts of the page and have them called from Sitemesh decorators for elements such as head and footer. (I believe Grails does something like this)
    * Create mini-controllers that are called through Service Side Includes/Edge Side Includes from a front end webserver.

    I have looked around a little but this topic seems to be very Grails heavy when you Google it.
    I would very much like to keep things on the "Spring-side" because this gives much more control.

    I am curious what strategies people use and if there are any pointers people could give me to implementing something like this or better yet, finding something already implemented.

    Kind regards,