Class Cache

  • All Implemented Interfaces:
    TreeCache

    public final class Cache
    extends Object
    implements TreeCache
    Concurrent (thread-safe) FIFO tree cache (using classes from java.util.concurrent). After the cache size reached a certain limit, some least recently used entry are removed, when adding a new entry.
    Author:
    Christoph Beck
    • Constructor Detail

      • Cache

        public Cache​(int capacity)
        Creates a new cache with the specified capacity and default concurrency level (16).
        Parameters:
        capacity - Cache size. The actual size may exceed it temporarily.
      • Cache

        public Cache​(int capacity,
                     int concurrencyLevel)
        Creates a new cache with the specified capacity and concurrency level.
        Parameters:
        capacity - Cache size. The actual map size may exceed it temporarily.
        concurrencyLevel - The estimated number of concurrently updating threads. The implementation performs internal sizing to try to accommodate this many threads.
    • Method Detail

      • size

        public int size()
      • put

        public void put​(String expression,
                        Tree tree)
        Description copied from interface: TreeCache
        Cache tree
        Specified by:
        put in interface TreeCache