rishabhdaim commented on code in PR #2819:
URL: https://github.com/apache/jackrabbit-oak/pull/2819#discussion_r3009321101


##########
oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/OakCache.java:
##########
@@ -56,21 +53,19 @@ public interface OakCache<K, V> {
 
     /**
      * Returns the value associated with {@code key}, computing it via
-     * {@code mappingFunction} and caching the result if it was absent.
+     * {@code valueLoader} and caching the result if it was absent.
      *
-     * <p>Matches Caffeine's {@code Cache.get(K, Function)} contract: any 
exception
-     * thrown by the mapping function propagates as an unchecked
-     * {@code RuntimeException} or {@code CompletionException}. Implementations
-     * backed by CacheLIRS bridge internally by wrapping any checked
-     * {@code ExecutionException} into {@code CompletionException}.</p>
+     * <p>Preserves the legacy Oak-visible cache contract: failures from the 
loader
+     * are exposed as {@link ExecutionException}.</p>
      *
-     * @param key             the key whose associated value is to be returned 
(must not be null)
-     * @param mappingFunction the function to compute a value if the key is 
absent (must not be null)
+     * @param key         the key whose associated value is to be returned 
(must not be null)
+     * @param valueLoader the loader used to compute a value if the key is 
absent (must not be null)
      * @return the current (existing or computed) value, or {@code null} if the
-     *         mapping function returns {@code null}
+     *         loader returns {@code null}
+     * @throws ExecutionException if the value cannot be loaded
      */
     @Nullable
-    V get(@NotNull K key, @NotNull Function<? super K, ? extends V> 
mappingFunction);
+    V get(@NotNull K key, @NotNull Callable<? extends V> valueLoader) throws 
ExecutionException;

Review Comment:
   Even I was in 2 mind to go which way, but decided Guava Style so that we 
don't need to change any existing code of `CacheLIRS`.
   
   But I don't have any strong preference.
   
   Instead, my first PR for adding APIs was in Caffience Style direction only, 
but when I delved into implementation, I didn't like that we needed to make 
code changes for old code and risk any regression.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to