Class RegexPatternCache


  • public class RegexPatternCache
    extends Object
    Cache for precompiled regex patterns used in StringUtil class
    Since:
    1.3.0
    Author:
    jozsef.kelemen
    • Constructor Detail

      • RegexPatternCache

        public RegexPatternCache()
        Instantiates a new Regex pattern cache.
      • RegexPatternCache

        public RegexPatternCache​(int cacheSize)
        Instantiates a new Regex pattern cache.
        Parameters:
        cacheSize - the cache size
    • Method Detail

      • getPattern

        public Pattern getPattern​(String patternKey)
        Gets a pattern from cache if found, compiles and stores otherwise.
        Parameters:
        patternKey - the pattern key
        Returns:
        the pattern
      • clear

        public void clear()
        Clear cache values