getRequired and handle for an 1 entity.
Right now part of CoreCacheManager
looks something like this:
public List<DTO> getAndHandleAll(List<ID> ids, Consumer<List<ID>> handleMissing) {}
public List<DTO> getAndHandle(List<ID> ids, Consumer<ID> handleMissing) {}
It would be nice to have something like
public DTO getOrHandleAndThrow(ID id, Consumer<ID> handleMissing) {}
so that we can deal with situations like this,
public class CapacitySession extends QueueSession<SelectionRequest> {
...
@Override
public boolean allowsRequest(Request<?> request) {
var session = getBean(SessionCacheManager.class).get(getSession()); // we soft delete the session here, and throw
...
}
}
We can achieve cascading soft deletes without this, it just increases code quality.
Edited by Henry Page