You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/09/29 19:09:56 UTC

[GitHub] [nifi] ben-manes commented on a diff in pull request #6364: NIFI-10192 Caffeine cache schema request for reuse

ben-manes commented on code in PR #6364:
URL: https://github.com/apache/nifi/pull/6364#discussion_r983930495


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/LookupRecord.java:
##########
@@ -548,8 +577,15 @@ public Set<Relationship> lookup(final Record record, final ProcessContext contex
 
             final FlowFile flowFile = lookupContext.getOriginalFlowFile();
             final Optional<?> lookupValueOption;
+            final Optional<?> lookupValueCacheOption;
+
             try {
-                lookupValueOption = lookupService.lookup(lookupCoordinates, flowFile.getAttributes());
+                lookupValueCacheOption = (Optional<?>) cache.get(lookupCoordinates, k -> null);

Review Comment:
   fyi, you can use `cache.getIfPresent(key)` to lookup or return null. Of course if possible it is preferred to compute within the cache to avoid a cache stampede.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org