Hi Radim
First of all, I don't think this is feasible. For example, read-committed vs repeatable read changes how the entries are stored in the transaction context, so you can't have a repeatable-read get() in the same transaction after a read-committed get. Write skew check also requires versions, so you couldn't skip updating the version in any optimistic cache just in case some transaction might need it in the future.
We also can't mix non-transactional, transactional asynchronous, and transactional synchronous operations on the same cache, as they would break each other's consistency. In fact, Infinispan 4.x allowed both transactional and non-transactional operations on the same cache, but at some point we realized that there's no way to ensure the consistency of transactions if there are overlapping with non-transactional operations.
I agree that the configuration is very tightly coupled with the code that uses it, so settings that can break the application should be more obvious. We should discuss how we can improve this at the clustering meeting in Berlin.
But I think forgetting to add a flag in some part of the application is just as likely as the administrator making a mistake in the configuration, and having different consistency models in the same cache can also make code harder to understand. So instead of allowing flags to control consistency, I would rather add methods for the user to assert that the cache has certain properties.
Cheers
Dan