Class LeastRecentlyUsed<T,​V>

  • Type Parameters:
    T - The cache key type.
    V - The cache value type.
    All Implemented Interfaces:
    Serializable, Cloneable, Map<T,​V>

    public class LeastRecentlyUsed<T,​V>
    extends LinkedHashMap<T,​V>
    A simple Least Recently Used cache implementation based on the standard Java SDK LinkedHashMap class.

    Specially maintains a cache up to the size limit specified. After which point will start to discard entries in Least Recently Used order.

    See Also:
    Serialized Form
    • Constructor Detail

      • LeastRecentlyUsed

        public LeastRecentlyUsed​(int maxSize)
        Constructs a new LeastRecentlyUsed cache.
        Parameters:
        maxSize - The maximum size of the cache.
    • Method Detail

      • getMaxSize

        public int getMaxSize()
        Get the maximum size of the cache.
        Returns:
        the maximum size of the cache.