-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Unable to use sync cache with reactivestreams #31861
Comments
@krizajb thanks for the report but I am not sure what you mean by "enforcing the use of Cache.retrieve". Can you please provide a bit more details as what was working and what is the problem now? |
The asynchronous Also, in terms of Reactive Streams detection, we do check the method signature for well-known reactive types when Reactive Streams is present. However, if the method signature does not indicate a reactive method or a |
Providing a sample code
This will produce the following exception This worked without a problem with springboot 3.1.6. Upgrading to 3.2.0 produces the mentioned issue. Thank you. |
So this is not related to In general, Spring's new reactive caching support is meant to handle such So you are relying on a caching a custom That said, I can see your argument that this is a regression for custom scenarios, so we may consider some way of opting out of the async cache arrangement. We could do so automatically but on the other hand we do not want to lose the setup exception for reactive cache arrangements that are meant to use an async cache (just possibly having forgotten to configure it). |
Oh, understood. What about the usage of |
All of the caching annotations understand |
I was not able to make it work with the additional info you provided. I tried removing the |
With a Any use of |
This produces an async behaviour that isn't desired. |
Well, the way we add those interactions to the reactive pipeline as a pre-step for a potential cache hit and a follow-up step to producing its value, the interactions have to be asynchronous. Regular Theoretically you may keep using synchronous cache interactions with Why do you prefer manually enforced caching through |
It's an existing code that operates like that, since the framework supported it I guess. |
I don't think that answers our question. Here it is again
|
Since the app depends on a certain sequence of events. To be exact, if |
On the timing concerns between cache put and lookup operations, with a local cache this won't be very different from a synchronous cache in practice. Even with That said, given this report and #31868, there seem to be several scenarios where such manual adaptation through |
Since commit
f99faac
that affected sync cache, I believe one can not integrate sync cache anymore sincespring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
enforces the use ofCache.retrieve
when reactivestreams are present.The text was updated successfully, but these errors were encountered: