I cache some queries in one method
@Override
@Cacheable(cacheNames = "user-actions")
public UserAction getUserAction(UUID userId) {
...
}
I'd like to evict cache in another method. It works if method has the same signature, for example
@CacheEvict(cacheNames = "user-actions")
public void evictUserLevel(UUID userId) {
log.info("Cache user-actions has been evicted");
}
But is there ways to evict cache if I don't pass userId to method in which cache will be evicted, or if it has more than one parameter? This doesn't work:
@CacheEvict(cacheNames = "user-actions")
public void processEvent(UserEvent event, UUID userId) {
...
}