Aurelien, sadly on CRUD ops many things can go wrong, I hinted to a couple of them in other posts:
deserialization failures when loading data from disk, disk failing, remote node being unavailable... most failures apply to non-heap caches though.
Thinking about this further, as I had a hunch ever since I wrote this `ResilientCache` example, I think we may well be looking at this wrong.
All the `Cache` failures on CRUD are actually `Store` (the SPI that backs the Cache up and let it store data) failures. Caches can fail for other reasons besides these: like `CacheLoader` or `CacheWriter` failures...
My main point behind wanting to have checked exceptions, is to force someone to handle these... Because I think a cache failure shouldn't bring the entire app down (or that thread, request, ... whatever). Instead, I'd like the Cache to be resilient. So why not have `Cache` be resilient _always_... And not throw exception (except if the user really wants it).
Basically come up with an API that naturally leads to doing the right thing, without being restrictive nor "straight in your face", just like implicit CacheLoaders aim at doing: implementing a "cache aside" pattern isn't easy and forces the user to understand much about the cache's internals; otoh the "cache through" pattern is much more easy to think about: register a loader & a writer and the cache will load when data is missing and update the SoR on writes, and all that in a thread safe way, without races.
I'm thinking we should try to do the same here: have the Cache be resilient, according to some definition, by default. You could specify what "resilience" mean depending on your usecase as well as deployment topology, maybe even providing your own `ResilienceStrategy` or something... But recoverable exceptions would then be handled internally, while unrecoverable ones, i.e. unchecked _and_ documented ones, would be the only ones "leaking" up.
Does this make sense? I'm thinking about giving this a shot, and doing a short spike on trying to come up with a concrete proposal in implementing some prototype around that idea... So for now, I'd argue ignore exceptions at the `Cache` level... internal SPI types though (like the `Store` interface, would declare explicit checked exception... but the `Cache` would be layer responsible to handle these "accordingly").
Thoughts?