Ken Schosinsky opened SPR-16530 and commented
Currently the caching annotations can only work with java.util.Optional. There's no support for other wrapper types (e.g. Vavr's Option/Try/Either/Lazy etc.).
I would like to be able to register custom return value unwrappers or something equivalent to the key property for the return value:
// Example with Vavr's Either
@CachePut(cacheNames = "myCache", condition = "#result.isRight()", result = "#result.getRight()")
Either<String, CacheData> myMethod(int id);
Greetings, Ken
Issue Links: - #20361 Allow transaction control via well-known method return types - #21058 Incorrect return type of Kotlin suspending functions