I have a method that saves cache.
@GetMapping("/orders")
@Cacheable(value = "List<Order>", key = "{#customerName+'s orders', #page, #size}")
public List<Order> findOrders(@RequestParam("customerName") String customerName,
@RequestParam(name = "page") int page,
@RequestParam(name = "size") int size) {
...
And I want to remove this cache after calling of this method.
@PostMapping("/order")
@CacheEvict(value = "*",key="{#makeOrderDTO.customerDTO.name+'s orders', '', 'regex:*'}")
public Order makeOrder(@RequestBody MakeOrderDTO makeOrderDTO) {
I have a problem that I want to remove all cached pages for customers, but I can't remove only one type of page. So I need to remove customers with all pages sizes and numbers. Maybe there is some kind of functionality like
@PostMapping("/order")
@CacheEvict(value = "*",key="{#makeOrderDTO.customerDTO.name+'s orders', 'regex:*', 'regex:*'}")
public Order makeOrder(@RequestBody MakeOrderDTO makeOrderDTO) {
or
@PostMapping("/order")
@CacheEvict(value = "*",key="{#makeOrderDTO.customerDTO.name+'s orders', 'any', 'any'}")
public Order makeOrder(@RequestBody MakeOrderDTO makeOrderDTO) {
Thanks in advance.