tchivs opened a new pull request, #4203:
URL: https://github.com/apache/flink-cdc/pull/4203
This PR introduces a **PatternCache** utility class to optimize regex
pattern compilation performance by caching compiled `Pattern` instances with
LRU eviction strategy.
## Brief change log
- **feat(common)**: Add `PatternCache` class with LRU-based caching
mechanism
- **perf(common)**: Integrate `PatternCache` into
`Predicates.setOfRegex()` method
- **test**: Add comprehensive unit tests including LRU eviction behavior
test
## Technical Details
### PatternCache Implementation
- Uses `LinkedHashMap` with access-order (`true`) for LRU behavior
- Maximum cache size: 100 patterns
- Thread-safe with `synchronized` methods
- Only caches patterns without flags (`regexFlags == 0`)
### Performance Benefits
- **Avoids repeated `Pattern.compile()` calls** for the same regex string
- **Reduces CPU overhead** in pattern-heavy operations
- **Improves throughput** for table pattern matching scenarios
### Integration Points
- `Predicates.setOfRegex()`: Uses cache when `regexFlags == 0`
- Patterns with flags are compiled directly without caching
--
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]