Github user markap14 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2343#discussion_r157231329
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteText.java
 ---
    @@ -209,6 +215,30 @@
         private volatile Map<Relationship, PropertyValue> propertyMap = new 
HashMap<>();
         private volatile Pattern groupingRegex = null;
     
    +    @VisibleForTesting
    +    final static int PATTERNS_CACHE_MAXIMUM_ENTRIES = 10;
    +
    +    /**
    +     * LRU cache for the compiled patterns. The size of the cache is 
determined by the value of
    +     * {@link #PATTERNS_CACHE_MAXIMUM_ENTRIES}.
    +     */
    +    @VisibleForTesting
    +    final ConcurrentMap<Pair<Boolean, String>, Pattern> patternsCache = 
CacheBuilder.newBuilder()
    --- End diff --
    
    I think we can simplify this some. Because the notion of 'ignore case' is 
going to be true for all regexes or false for all regexes, I think we can get 
rid of the Pair<Boolean, String> and just use String as the key. Then we'd just 
need to ensure that we clear the cache in the @OnScheduled method or in the 
onPropertyModified if that property is changed.


---

Reply via email to