Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.1 - @CachePut for methods that return void Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.1 - @CachePut for methods that return void

    Consider the following:

    Code:
    @CachePut(value="orders", key="#order.orderId")
    public void addOrder(Order order)
    @CachePut uses the method return value as the value to insert into the cache. Is it somehow possible to tell it to use the order method argument instead? If not, using Spring caching is a show stopper as many of my add/update operations return void.

    Thanks
    G. Patel

  • #2
    Anybody? Is there a way to achieve this?

    I do not understand why this is not supported. It is a rather bold assumption to assume that most add/update service methods always return the entity being added or updated. It would be a good idea to have an attribute for the CachePut annotation to specify the value to be cached (return value or argument) in addition to the key.

    Comment


    • #3
      But is it working for the similar type return which cached initially ? I tried to implement
      @CachePut and @CacheEvict for the same type but it does not work.
      Please help me how to implement them.

      Thanks !

      Comment

      Working...
      X