Announcement Announcement Module
No announcement yet.
Cache abstraction - configurable KeyGenerator per method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cache abstraction - configurable KeyGenerator per method

    I have noticed that I can change default cache KeyGenerator implementation by setting key-generator attribute on <cache:annotation-driven> element. Is there any way to set custom KeyGenerator per method?
    My use case is:
    In a project, default KeyGenerator (based on parameters) is ok for most methods. But there are methods I want to cache per user (user is stored in ThreadLocal). Hence I need different KeyGenerator implementations for different methods.
    Key generators are configurable per @Cacheable annotation in the ehcache-spring-annotations project. Can I do simmilar thing in Spring 3.1 cache abstraction?

    Regards, Libor