rishabhdaim commented on code in PR #1779:
URL: https://github.com/apache/jackrabbit-oak/pull/1779#discussion_r1829209783


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java:
##########
@@ -915,7 +922,25 @@ public NodeDocumentCache 
buildNodeDocumentCache(DocumentStore docStore, NodeDocu
         return new NodeDocumentCache(nodeDocumentsCache, 
nodeDocumentsCacheStats, prevDocumentsCache, prevDocumentsCacheStats, locks);
     }
 
-    public Cache<StringValue, StringValue> 
buildPrevNoPropCache(DocumentNodeStore store) {
+    /**
+     * Checks the feature toggle for prevNoProp cache and returns true if 
that's enabled
+     * @return true if the prevNoProp feature toggle is enabled, false 
otherwise
+     */
+    private boolean isPrevNoPropCacheEnabled() {
+        final Feature prevNoPropFeature = getPrevNoPropCacheFeature();
+        return prevNoPropFeature != null && prevNoPropFeature.isEnabled();
+    }
+
+    /**
+     * Builds the prevNoProp cache, if the corresponding feature toggle is 
enabled.
+     * Returns null otherwise
+     * @return null if prevNoProp feature is disabled and size non-null, a 
newly built cache otherwise
+     */
+    public Cache<StringValue, StringValue> buildPrevNoPropCacheOrNull() {

Review Comment:
   IMO `buildPrevNoPropCache` should be sufficient with javadocs explaining 
that the return value could be `null`.
   
   Also, we should annotates this method with `@Nullable`.



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