madrob commented on a change in pull request #230:
URL: https://github.com/apache/solr/pull/230#discussion_r683729013



##########
File path: solr/core/src/java/org/apache/solr/search/CaffeineCache.java
##########
@@ -190,73 +191,72 @@ public V get(K key) {
     return cache.getIfPresent(key);
   }
 
-  @Override
-  public V computeIfAbsent(K key, IOFunction<? super K, ? extends V> 
mappingFunction) throws IOException {
-    /*
-    This block will get deleted before commit, but I'm leaving it in for now 
in case I have to go back to that apporach
+  private V computeAsync(K key, IOFunction<? super K, ? extends V> 
mappingFunction) throws IOException {
+    // First do a lookup first: optimistic non-locking path.
+    // The cache does this for us on get(K, Function), but not putIfAbsent
+    V value = get(key);
+    if (value != null) {
+      return value;
+    }

Review comment:
       It looks like there's an interesting discrepancy here still, where the 
get from compute will increment the cache lookups stat, while the get in put 
will not increment the stat. I'm reading the source for 2.9.4 - I don't think 
we're ready to go to 3.x yet, although I'll probably do that as soon as I'm 
done with this issue.




-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to