@Service
public class ProductService {
@Cacheable("products")
public Product findById(Long id) { ... } // caches the result
@CachePut(value = "products", key = "#p.id")
public Product update(Product p) { ... } // updates the cache
@CacheEvict(value = "products", key = "#id")
public void delete(Long id) { ... } // removes from cache
}@Cacheable, @CachePut, @CacheEvict
Declarative caching annotations that avoid re-running expensive method calls when the same input has already been computed.