924060929 commented on code in PR #66914:
URL: https://github.com/apache/doris/pull/66914#discussion_r3820672693


##########
fe/fe-connector/fe-connector-cache/src/main/java/org/apache/doris/connector/cache/MetaCacheEntry.java:
##########
@@ -84,6 +85,19 @@ public MetaCacheEntry(String name, Function<K, V> loader, 
CacheSpec cacheSpec, E
     public MetaCacheEntry(String name, Function<K, V> loader, CacheSpec 
cacheSpec,
             ExecutorService refreshExecutor, boolean autoRefresh, boolean 
contextualOnly,
             long refreshAfterWriteSeconds, boolean manualMissLoadEnabled) {
+        this(name, loader, cacheSpec, refreshExecutor, autoRefresh, 
contextualOnly,
+                refreshAfterWriteSeconds, manualMissLoadEnabled, null);
+    }
+
+    /**
+     * Creates an entry with a synchronous removal listener. The listener is 
invoked when a cached value is
+     * evicted or invalidated, allowing the cache to release resources owned 
by the value (e.g. Iceberg FileIO).
+     * This variant does not use refreshAfterWrite, so synchronous removal is 
safe.
+     */
+    public MetaCacheEntry(String name, Function<K, V> loader, CacheSpec 
cacheSpec,
+            ExecutorService refreshExecutor, boolean autoRefresh, boolean 
contextualOnly,
+            long refreshAfterWriteSeconds, boolean manualMissLoadEnabled,

Review Comment:
   Fixed on current head a55eb2af80e9c0880775050c65811dce3f3b9a12. 
MetaCacheEntry now exposes only the JDK BiConsumer<K,V> cleanup callback and 
keeps the Caffeine RemovalListener adapter private to the cache framework. The 
callback also covers disabled and invalidation-suppressed loads. Added 
deterministic callback coverage in MetaCacheEntryTest.



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