-
Notifications
You must be signed in to change notification settings - Fork 116
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
Simplify ConfigurationSource (remove reload() method) and add caching layer #148
Conversation
… between consecutive calls to the reload() method
…y between consecutive calls to the reload() method
…tween consecutive calls to the reload() method
…een consecutive calls to the reload() method
…etween consecutive calls to the reload() method
…iability between consecutive calls to the reload() method
…tween consecutive calls to the reload() method
… between consecutive calls to the reload() method
@fromanator, @majkiw - what are your thoughts on this? |
I definitely like the idea. Are we losing anything important with this change? Also, now that caching is separated from |
Oh, right, that's the |
@majkiw You're right, I'm going to add a Making caching optional sounds good since it's hard to model the "always latest" configuration strategy with |
TL;DR:
Summary:
I'm making a backward-incomatible (hence version 5.0.0) change altering the the ConfigurationSource contract. Here's the idea and the reasoning behind it.
So far each configuration source had to guarantee that between two consecutive calls to the reload() method the result of getConfiguration(Environment) call will not change. This assumption had few side effects:
Also it feels like configuration sources shouldn't deal with reloading since they sole responsibility was to to hide the storage-layer details behind a uniform interface.
So, now the change :) The ConfigurationSource interface does not extend the Reloadable interface anymore. Instead I introduced a CachedConfigurationSource that is responsible for caching the results from any other configuration source. It's now being used by default by the ConfigurationProviderBuilder to wrap the source that was passed by a user.