-
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
CaffeineCacheManager supports async loading value #30122
Conversation
Sorry, but we don't accept PRs without any rationale nor explanation, especially for new features and new API. If I understand correctly, this change would turn cache entries into Also, please run the build locally before submitting a PR - this change is failing the build. |
Hello, @bclozel . It's my mistake. I just ran the test but forgot to check the style. My intention is not to get CompletableFuture to make asynchronous calls, but to be able to use asynchronous API when refreshing the cache (this can avoid executor blocking). The problem I have encountered is that when using Spring Cloud LoadBalancer (it uses CaffeineCacheManager to cache service instances), I don't want to get the instance from the registry when it expires, but pull the latest content from the registry regularly And replace the content in the cache (Caffeine provides the ability to refresh regularly). Most registry SDKs provide asynchronous APIs to avoid blocking the calling thread, but now CaffeineCacheManager only supports synchronous loading of values, so I have to convert asynchronous to synchronous and block here, which will affect the update of other cache values. In fact, because |
While this has been declined initially (and cannot be reopened anymore as a pull request), I'm effectively addressing this along with #17920 now. |
No description provided.