This repository was archived by the owner on Nov 13, 2025. It is now read-only.
Do not cache default values across subsequent invocations - #10
Open
oskarwiksten wants to merge 1 commit into
Open
Do not cache default values across subsequent invocations#10oskarwiksten wants to merge 1 commit into
oskarwiksten wants to merge 1 commit into
Conversation
oskarwiksten
force-pushed
the
do-not-cache-default-values
branch
2 times, most recently
from
October 14, 2021 05:44
bdff02b to
1c83e50
Compare
* Separate cached `DynamicProperty` instances not only by their type and property name, but also by which default value the applicaiton requests.
* Reason for separating is to make different invocations to, for example, `getStringProperty(key, default)` not always return the default value from the first invocation for subsequent invocations to the property value, if the value is missing from the config source.
* Previously, code like the following for an empty config source:
```
String v1 = dynamicConfig.getStringProperty("key", "first").get();
String v2 = dynamicConfig.getStringProperty("key", "second").get();
```
.. would yield the value `"first"` for `v2`. With this commit, `v2` will instead get the value `"second"`.
oskarwiksten
force-pushed
the
do-not-cache-default-values
branch
from
October 19, 2021 14:06
1c83e50 to
ad29d23
Compare
askoog
approved these changes
Nov 2, 2021
askoog
left a comment
Contributor
There was a problem hiding this comment.
I like this idea! This is more intuitive than the present solution. Might require some investigation about current usage though. This change might lead to unexpected behavior
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DynamicPropertyinstances not only by their type and property name, but also by which default value the applicaiton requests.getStringProperty(key, default)not always return the default value from the first invocation for subsequent invocations to the property value, if the value is missing from the config source... would yield the value
"first"forv2. With this commit,v2will instead get the value"second".