Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the "refresh" and "refresh all" functionality in the LoadingCache and its tests. Key changes include:
- Adding two new methods (refresh and refreshAll) in LoadingCache.kt that delegate to the underlying Caffeine cache.
- Creating corresponding tests in AsLoadingCacheTest.kt to verify refresh behavior for single and multiple keys.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| aedile-core/src/test/kotlin/com/sksamuel/aedile/core/AsLoadingCacheTest.kt | Added tests to verify refresh and refreshAll functionality. |
| aedile-core/src/main/kotlin/com/sksamuel/aedile/core/LoadingCache.kt | Introduced refresh and refreshAll methods for cache refresh operations. |
Vampire
reviewed
Apr 18, 2025
Comment on lines
+184
to
+194
| fun refresh(key: K) { | ||
| cache.synchronous().refresh(key) | ||
| } | ||
|
|
||
| /** | ||
| * Loads a new value for each key, asynchronously. While the new value is loading the | ||
| * previous value (if any) will continue to be returned by get(key) unless it is evicted. | ||
| * | ||
| * See full docs at [com.github.benmanes.caffeine.cache.LoadingCache.refreshAll]. | ||
| */ | ||
| fun refreshAll(keys: Collection<K>) { |
There was a problem hiding this comment.
Shouldn't the new methods be suspending, calling await and returning the value?
Owner
Author
There was a problem hiding this comment.
Yes, I don't know what I was thinking?!
2.1.1 coming out
There was a problem hiding this comment.
... sorry to bug again, but what about the return value? :-)
Owner
Author
There was a problem hiding this comment.
This is what happens when I do things after drinking :)
Try 2.1.2
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #38