Skip to content

Caching emitted values of monos #25280

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

Closed
pstitt opened this issue Jun 18, 2020 · 2 comments
Closed

Caching emitted values of monos #25280

pstitt opened this issue Jun 18, 2020 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@pstitt
Copy link

pstitt commented Jun 18, 2020

Spring caching does not currently work as I would expect for methods that return a Mono type. I suggest an enhancement to support the caching of the value emitted from the mono as opposed to the mono itself.

E.g.

@Cacheable(...)
public Mono<> expensiveOperation(...)

It should work in the same way as for any other cacheable except targeting the emitted value rather than the actual mono. In particular it should support custom keys, cache managers, etc.

We have a rough implementation that we are using at Booking.com. I’d be happy to contribute to this if it is accepted.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 18, 2020
@pstitt
Copy link
Author

pstitt commented Jun 18, 2020

Btw, I have searched stack overflow. Although there are alternative solutions such as reactor’s CacheMono, these require more code and are not as natural for people already familiar with spring caching.

@bclozel bclozel added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 18, 2020
@bclozel
Copy link
Member

bclozel commented Jun 18, 2020

Closing as a duplicate of #17920. Feel free to comment that issue.

Thanks!

@bclozel bclozel closed this as completed Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants