yuqi1129 commented on code in PR #13099:
URL: https://github.com/apache/gravitino/pull/13099#discussion_r4003152755


##########
core/src/main/java/org/apache/gravitino/cache/CaffeineEntityCache.java:
##########
@@ -335,7 +335,12 @@ private <KEY, VALUE> Caffeine<KEY, VALUE> 
newBaseBuilder(Config cacheConfig) {
     }
 
     if (cacheConfig.get(Configs.CACHE_EXPIRATION_TIME) > 0) {
-      builder.expireAfterAccess(
+      // Expire after write, not after access. The TTL is the safety net for a 
cross-node
+      // invalidation that never arrives (a lost entity_change_log row, a 
stalled poller). With an
+      // access-based TTL a stale entry that keeps being read would never 
expire, so a single missed
+      // invalidation would become permanent on exactly the hottest keys. A 
write-based TTL bounds
+      // that staleness to expireTimeInMs.
+      builder.expireAfterWrite(
           cacheConfig.get(Configs.CACHE_EXPIRATION_TIME), 
TimeUnit.MILLISECONDS);

Review Comment:
   Tracked separately in #13136.



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