Reputation: 1157
Is it possible to use @CachePut
and @Cacheable
in conjonction on the same method?
@CachePut(value ="cacheName", key = "#id", condition="#cachedData==false")
@Cacheable(value ="cacheName", key = "#id", condition="#cachedData==true")
public Foo doSomthing(String id, boolean cachedData){...}
Upvotes: 0
Views: 1477
Reputation: 634
I think you can use @Caching
to group multiple caching annotations to implement a customised logic.
Maybe something like:
@Caching(
put= { @CachePut(value="cacheName", key="#id", condition="#cachedData==false") },
cacheable = { @Cacheable(value ="cacheName", key="#id", condition="#cachedData==true") }
)
public Foo doSomething(String id, boolean cachedData){...}
Upvotes: 2