blcksrx commented on code in PR #14440:
URL: https://github.com/apache/iceberg/pull/14440#discussion_r2478088667
##########
core/src/main/java/org/apache/iceberg/CachingCatalog.java:
##########
@@ -104,15 +126,26 @@ public void onRemoval(TableIdentifier tableIdentifier,
Table table, RemovalCause
}
private Cache<TableIdentifier, Table> createTableCache(Ticker ticker) {
- Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder().softValues();
+ Caffeine<TableIdentifier, Table> cacheBuilder =
+ Caffeine.newBuilder()
+ .softValues()
+ .removalListener(new MetadataTableInvalidatingRemovalListener())
+ .executor(Runnable::run)
+ .ticker(ticker);
if (expirationIntervalMillis > 0) {
- return cacheBuilder
- .removalListener(new MetadataTableInvalidatingRemovalListener())
- .executor(Runnable::run) // Makes the callbacks to removal listener
synchronous
- .expireAfterAccess(Duration.ofMillis(expirationIntervalMillis))
- .ticker(ticker)
- .build();
+ switch (cachePolicy) {
+ case "EXPIRE_AFTER_WRITE":
+ cacheBuilder =
cacheBuilder.expireAfterWrite(Duration.ofMillis(expirationIntervalMillis));
+ break;
+ case "EXPIRE_AFTER_ACCESS":
+ cacheBuilder =
+
cacheBuilder.expireAfterAccess(Duration.ofMillis(expirationIntervalMillis));
+ break;
+ default:
Review Comment:
well, also it needs a switch case, right?
--
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]