-
Notifications
You must be signed in to change notification settings - Fork 82
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
Deprecating cache utilities (removal in 3.6.0) #237
Comments
My understanding from this article: We are not able to use our loved caching annotations when working with custom cache-manager, because the serialization of the class is required and Mono/Flux are not serializable. Is there any plan to support the caching annotation in the future when working with webflux? Louis-Michel |
Thanks for chiming in @wer-mathurin ! There is indeed a missing piece in the cache abstraction, but one caveat I could gather from looking at these various projects and issues is that unless the backing cache provider supports async use cases (and especially async write-through), it is going to be difficult to come up with a reliable abstraction (like From what I can gather, there isn't a whole lot of caches that provide async APIs (basically, Caffeine). Off-memory distributed caches might have an even greater challenge in supporting this. My guess is that this is why no |
We've decided to phase out these utilities for the reasons mentioned above. |
Is there a plan/intent to introduce caching feature? |
At the moment we are not considering active development or maintenance of a new caching mechanism. However, here's what we can offer at this time to not discourage your efforts: if you have a proof of concept, feel free to host it as your repository and share with us for feedback by opening a new issue. In that issue we can discuss advertising your caching mechanism from the Reactor resources. If your solution gains some traction and you still feel like it, we can get back to the subject at that point and discuss if at that time you are willing and whether we have the resources to help integrate it here. What do you think @jayanthpatki91? |
Embarrassingly, I only now got around to experimenting with Reactor to understand the reactive streams programming model. While this was a poor fit and shouldn't be used, the combination is actually quite beautiful in two advanced scenarios. In this example, a Another scenario to a write-back cache, where changes are batched and flushed some time after the cache was updated. That might be useful for a replicated cache or similar setups. In this case key-order is maintained using a In both cases the reactive logic is very trivial and composes very neatly with the caching library. In the inverse, Spring 6.1 adds support for AsyncLoadingCache so that Spring Cache can return reactive types like |
Motivation
CacheMono
andCacheFlux
helpers were an attempt at providing a sane solution to adapt various cache / means of caching into a reactive facade.There is very little bandwidth to maintain it, and it seems it is not entirely helpful. Maybe even going as far as causing more problems than it solves.
See for example #162, #181, #201 (and recently closed #234...)
When using a caching solution like https://github.com/ben-manes/caffeine that has a future-based async API, we can recommend to just wrap the futures using
Mono#toFuture()
andMono.fromFuture(f)
.For other use cases for
CacheFlux
I could find in the wild the path would be a bit more ambiguous.A few relevant projects that build up on
CacheFlux
/CacheMono
I could find in github include:@EnableCaching
spring annotation backed byCacheMono
)ReactiveCacheManager
wrapping spring'sCache
andCacheManager
CacheMono
with a map and caffeineCacheMono
CacheFlux
in theCachingRouteLocator
(backed by aConcurrentHashMap
)Desired solution
One of the following outcomes:
CacheFlux
/CacheMono
into a separate community-supported project, deprecatereactor.cache
classes in favor of said community projectCacheFlux
/CacheMono
overcome the benefits, deprecatereactor.cache
classes for future removalpinging the owners of the above projects for feedback:
@deeperunderstanding, @Odysseymoon, @alex-pumpkin, @rezaarshad, @pkgonan, @Hothire, @making, @mmaggioni, @spencergibb.
also pinging users that contributed to discussions in the above issues:
@dave-fl, @cybuch, @wer-mathurin, @ben-manes, @hmble2, @dannyjiang001
The text was updated successfully, but these errors were encountered: