feat!: changing cache provider to caffeine over guava #1065
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.
This PR changes the implementation of caching from Guava to Caffeine.
Related Issues
Resolves thomaspoignant/go-feature-flag#1985 from go-feature-flag.
Notes
This change introduces a breaking change on the API, because the property cacheConfig of GoFeatureFlagProviderOptions now expects a Caffeine configuration object instead of a Guava CacheBuilder object.
Testing
This implementation caused test failure on should_resolve_from_cache_max_size in GoFeatureFlagProviderTest.
Unlike Guava, Caffeine does not guarantee that the cache size never exceeds the specified limit at any time due to important differences in the eviction algorithm compared to Guava.
Because of this, the last assertion from this test case was removed.
More about these differences can be found here:
Caffeine Wiki - Guava
ben-manes/caffeine#420 (comment)
Follow-up Tasks
We need to document the breaking changes on the API in:
@thomaspoignant I opened a new PR because I messed up with my GPG signature and had to rewrite a lot of commits