Following @Cacheable annotation
@Cacheable(value="books", key="#isbn")
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
So that next time this method is called with same arguments it will be fetched from cache.
What I want instead is just to
I don't want to update the cache in case of cache-miss, is there any way to do this using spring Annotation
Here is what I ended up with, trick was to use 'unless' to our advantage
@Cacheable(value="books", key="#isbn", unless = "#result == null")
public Book findBookFromCache(ISBN isbn, boolean checkWarehouse, boolean includeUsed)
{
return null;
}
this method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With