Class PatternCacheLRU

  • All Implemented Interfaces:
    PatternCache

    public final class PatternCacheLRU
    extends GenericPatternCache
    This class is a GenericPatternCache subclass implementing an LRU (Least Recently Used) cache replacement policy. In other words, patterns are added to the cache until it becomes full. Once the cache is full, when a new pattern is added to the cache, it replaces the least recently used pattern currently in the cache. This is probably the best general purpose pattern cache replacement policy.
    Since:
    1.0
    See Also:
    GenericPatternCache
    • Constructor Detail

      • PatternCacheLRU

        PatternCacheLRU​(int capacity,
                        PatternCompiler compiler)
        Creates a PatternCacheLRU instance with a given cache capacity, and initialized to use a given PatternCompiler instance as a pattern compiler.

        Parameters:
        capacity - The capacity of the cache.
        compiler - The PatternCompiler to use to compile patterns.
      • PatternCacheLRU

        PatternCacheLRU​(PatternCompiler compiler)
        Same as:
         PatternCacheLRU(GenericPatternCache.DEFAULT_CAPACITY, compiler);
         
      • PatternCacheLRU

        PatternCacheLRU​(int capacity)
        Same as:
         PatternCacheLRU(capacity, new Perl5Compiler());
         
      • PatternCacheLRU

        public PatternCacheLRU()
        Same as:
         PatternCacheLRU(GenericPatternCache.DEFAULT_CAPACITY);