Saturday, April 23, 2022

Caching with Spring

 @Cachable: Runs before actual method invocation


@CachePut: Runs after the actual method invocation


Unless: works for return value

Condition: works for method parameter


@Cacheable(value = "saveCache", key = "{#a, #b, #c}", unless="#result.result.size() > 0")


@CachePut(value="defaultCache", key="#pk",unless="#result==null")


@Cacheable(value="actors", key="#key", condition="#key == 'sean'")