-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return the result of an immediate refreshAfterWrite (#688)
In Guava if the CacheLoader returns a completed future on a reload then the new value is returned to the caller and overwritten in the cache. Otherwise the last read value is returned and the future overwrites when it is done. This behavior is now supported instead. A quirk in Guava is when using Cache.get(key, callable). In Guava this is wrapped as the cache loader and is used if a refresh is triggered. That causes the supplied CacheLoader's reload to not be called, which could be more surprising. However, their asMap().computeIfAbsent does not trigger a refresh on read so the value is not reloaded. As this behavior is confusing and accidental, Caffeine will always use the attached CacheLoader and its reload function for refreshing.
- Loading branch information
Showing
3 changed files
with
150 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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