Class Cache

  • All Implemented Interfaces:
    TreeCache

    public final class Cache
    extends Object
    implements TreeCache
    Simple (thread-safe) LRU cache. After the cache size reached a certain limit, the least recently used entry is removed, when adding a new entry.
    Author:
    Christoph Beck
    • Constructor Detail

      • Cache

        public Cache​(int size)
        Constructor. Use a WeakHashMap as secondary map.
        Parameters:
        size - maximum primary cache size
      • Cache

        public Cache​(int size,
                     Map<String,​Tree> secondary)
        Constructor. If the least recently used entry is removed from the primary cache, it is added to the secondary map.
        Parameters:
        size - maximum primary cache size
        secondary - the secondary map (may be null)