kbendick commented on a change in pull request #3801:
URL: https://github.com/apache/iceberg/pull/3801#discussion_r774846264



##########
File path: core/src/main/java/org/apache/iceberg/CachingCatalog.java
##########
@@ -105,14 +103,14 @@ public void delete(TableIdentifier tableIdentifier, Table 
table, RemovalCause ca
   }
 
   private Cache<TableIdentifier, Table> createTableCache(Ticker ticker) {
+    boolean hasExpiration = expirationIntervalMillis > 0;
     Caffeine<TableIdentifier, Table> cacheBuilder = Caffeine
         .newBuilder()
         .softValues()
-        .removalListener(identLoggingRemovalListener);
+        .removalListener(hasExpiration ? new 
MetadataTableInvalidatingRemovalListener() : identLoggingRemovalListener);

Review comment:
       Nit: all of the stuff that gets added due to expiration should ideally 
be inside of the `if (hasExpiration)` block or in the return statement after 
that section if it's for non-expiring cache (i.e. the 
`identLoggingRemovalListener` here).
   
   Can you split this line into that block (and the block after it for the 
`identLoggingRemovalListener`.
   
   This would also remove the need for the local variable `hasExpiration`.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to