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


##########
core/src/main/java/org/apache/gravitino/cache/ReverseIndexCache.java:
##########
@@ -45,6 +47,25 @@ public class ReverseIndexCache {
   /** Registers a reverse index processor for a specific entity class. */
   private final Map<Class<? extends Entity>, ReverseIndexRule> 
reverseIndexRules = new HashMap<>();
 
+  /**
+   * Map from data entity key to a list of entity cache relation keys. This is 
used for reverse
+   * indexing.
+   *
+   * <p>For example, a role entity may be related to multiple securable 
objects, so we need to
+   * maintain a mapping from the role entity key to the list of securable 
object keys. that is
+   * dataToReverseIndexMap: roleEntityKey -> [securableObjectKey1, 
securableObjectKey2, ...]
+   *
+   * <p>This map is used to quickly find all the related entity cache keys 
when we need to
+   * invalidate in the reverse index if a role entity is updated. The 
following is an example: a
+   * Role a has securable objects s1 and s2, so we have the following mapping: 
<br>
+   * cacheData: role1 -> role entity reverseIndex: s1 -> [role1], s2 -> 
[role1] </br>
+   *
+   * <p>When we update role1, we need to invalidate s1 and s2 from the reverse 
index, or the data
+   * will be in the memory forever. However, the current implementation of 
ReverseIndexCache does
+   * not support this operation directly as we do not maintain such a map.

Review Comment:
   Okay, it should be **the current main branch**. Let me optimize it. 



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