Results 1 to 3 of 3

Thread: Spring 3.1 - @CachePut for methods that return void

  1. #1
    Join Date
    May 2008
    Posts
    7

    Default 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. #2
    Join Date
    May 2008
    Posts
    7

    Default

    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.

  3. #3
    Join Date
    May 2013
    Location
    Pune
    Posts
    1

    Default

    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 !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •