Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache, allow custom wrapper types other than java.util.Optional [SPR-16530] #21073

Closed
spring-projects-issues opened this issue Feb 23, 2018 · 0 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 23, 2018

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:

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.x Backlog milestone Jan 11, 2019
@jhoeller jhoeller closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
@jhoeller jhoeller removed this from the 6.x Backlog milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants